---
title: Negative values in the Modbus registers
description: The purpose of this article is to present the method of reading negative values ​​of Modbus registers.
---

[Skip to content](https://knowledgebase.grenton.com/en/negative-values-in-the-modbus-registers#main-content)

- [English](https://knowledgebase.grenton.com/en/negative-values-in-the-modbus-registers)
- [Polski](https://knowledgebase.grenton.com/pl/ujemne-wartości-w-rejestrach-modbus)

English

Show submenu for translations

[New ticket](https://knowledgebase.grenton.com/en/kb-tickets/new?hsLang=en) [Customer portal](https://knowledgebase.grenton.com/wsparcie?hsLang=en)

![Logo\_Grenton\_Main\_2020\_RGB\_v1.0-1.png\]](https://knowledgebase.grenton.com/hs-fs/hubfs/Logo_Grenton_Main_2020_RGB_v1.0-1.png?width=200&height=94&name=Logo_Grenton_Main_2020_RGB_v1.0-1.png)

Open main navigation

Close main navigation

- - [English](https://knowledgebase.grenton.com/en/negative-values-in-the-modbus-registers)
    - [Polski](https://knowledgebase.grenton.com/pl/ujemne-wartości-w-rejestrach-modbus)

  English
  
  Show submenu for translations
- [New ticket](https://knowledgebase.grenton.com/en/kb-tickets/new)
- [Customer portal](https://knowledgebase.grenton.com/wsparcie)
- [Trainings](https://www.grenton.com/cooperation/trainings.html)

[Trainings](https://www.grenton.com/cooperation/trainings.html)

 Hello. How can we help you?

- There are no suggestions because the search field is empty.

1. [Knowledge Base](https://knowledgebase.grenton.com/en?hsLang=en)
2. [Manuals](https://knowledgebase.grenton.com/en/manuals?hsLang=en)
3. [Gate Modbus](https://knowledgebase.grenton.com/en/manuals?hsLang=en#gate-modbus)

# Negative values in the Modbus registers

To read negative values of Modbus registers, one must subtract the number 65536 from the read value from the register.

Below is an example of how this can be done:

1\. We create a user variable to which the result of the action in the script will be passed

![](https://knowledgebase.grenton.com/hubfs/Knowledge%20Base%20Import/s3.amazonaws.comcdn.freshdesk.comdatahelpdeskattachmentsproduction35149721997originalLP-qzQ0W3cD_qUJLwz1rhAbefrI1DNAojg-1.png)

2\. Then we will prepare the script:

```
if(ModBus->Rejestr_odczytu->RegisterValue>=32768) thenModBus->temp=(ModBus->Rejestr_odczytu->RegisterValue-65536)/10else ModBus->temp=ModBus->Rejestr_odczytu->RegisterValue/10end
```

3\. The script will be triggered by the OnChange event in the Modbus virtual object:

![](https://knowledgebase.grenton.com/hubfs/Knowledge%20Base%20Import/s3.amazonaws.comcdn.freshdesk.comdatahelpdeskattachmentsproduction35150621267originalVif34k2RL6g6W-RTOIF9BT_Dq9-DFG03WQ-1.png)

4\. After sending the configuration, a negative value should be returned to the user property:

![](https://knowledgebase.grenton.com/hubfs/Knowledge%20Base%20Import/s3.amazonaws.comcdn.freshdesk.comdatahelpdeskattachmentsproduction35150621854originalJbUrEQLJecM-NctaFsUDTOOPpsL7Xm4fTg-1.png)  
![](https://knowledgebase.grenton.com/hubfs/Knowledge%20Base%20Import/support.grenton.plensupportsolutionsarticles35000190973-negative-values-in-the-modbus-registershit-1.gif)

- [Installation guidelines](https://knowledgebase.grenton.com/en/installation-guidelines?hsLang=en#main-content)

    - [How to Prepare Electrical Installation](https://knowledgebase.grenton.com/en/installation-guidelines?hsLang=en#how-to-prepare-electrical-installation)
- [Reference devices](https://knowledgebase.grenton.com/en/reference-devices?hsLang=en#main-content)

    - [Integrated Device](https://knowledgebase.grenton.com/en/reference-devices?hsLang=en#integrated-device)
- [Most Common Mistakes](https://knowledgebase.grenton.com/en/most-common-mistakes?hsLang=en)
- [Electrical Installation](https://knowledgebase.grenton.com/en/electrical-installation?hsLang=en)
- [Manuals](https://knowledgebase.grenton.com/en/manuals?hsLang=en#main-content)

    - [Gate Modbus](https://knowledgebase.grenton.com/en/manuals?hsLang=en#gate-modbus)
    - [Training](https://knowledgebase.grenton.com/en/manuals?hsLang=en#training)
    - [SW Applications](https://knowledgebase.grenton.com/en/manuals?hsLang=en#sw-applications)
    - [Gate HTTP](https://knowledgebase.grenton.com/en/manuals?hsLang=en#gate-http)
    - [Smart Panel](https://knowledgebase.grenton.com/en/manuals?hsLang=en#smart-panel)
    - [Configuration](https://knowledgebase.grenton.com/en/manuals?hsLang=en#configuration)
    - [myGrenton interfaces](https://knowledgebase.grenton.com/en/manuals?hsLang=en#mygrenton-interfaces)
    - [Virtual Objects](https://knowledgebase.grenton.com/en/manuals?hsLang=en#virtual-objects)
    - [Gate Alarm](https://knowledgebase.grenton.com/en/manuals?hsLang=en#gate-alarm)
- [Intercom](https://knowledgebase.grenton.com/en/intercom?hsLang=en)
- [FAQ](https://knowledgebase.grenton.com/en/faq?hsLang=en#main-content)

    - [FAQ](https://knowledgebase.grenton.com/en/faq?hsLang=en#faq)
    - [About Grenton](https://knowledgebase.grenton.com/en/faq?hsLang=en#about-grenton)
- [Price list and documents](https://knowledgebase.grenton.com/en/price-list-and-documents?hsLang=en)

[![Grenton logo](https://knowledgebase.grenton.com/hs-fs/hubfs/Logo_Grenton_variants_BIG_2020_plus_RGB_v0.2-02.png?width=400&height=100&name=Logo_Grenton_variants_BIG_2020_plus_RGB_v0.2-02.png "Grenton logo")](http://grenton.com)

<https://www.facebook.com/grenton.smart.home> <https://www.instagram.com/grenton_smart_home/> <https://www.youtube.com/channel/UCFNNI-dgO1cm81kCrSr1bzg> <https://www.linkedin.com/company/grenton>

Copyright © 2026, Grenton Sp.z o.o.