---
title: Ujemne wartości w rejestrach Modbus
description: Celem artykułu jest przedstawienie sposobu odczytu ujemnych wartości rejestrów Modbus.
---

[Przejdź do treści](https://knowledgebase.grenton.com/pl/ujemne-wartości-w-rejestrach-modbus#main-content)

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

Polski

Pokaż podmenu do tłumaczenia

[Nowe zgłoszenie](https://knowledgebase.grenton.com/pl/kb-tickets/new?hsLang=pl) [Portal klienta](https://knowledgebase.grenton.com/wsparcie?hsLang=pl)

![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)

Otwórz główne menu nawigacji

Zamknij główne menu nawigacji

- - [Polski](https://knowledgebase.grenton.com/pl/ujemne-warto%C5%9Bci-w-rejestrach-modbus)
    - [English](https://knowledgebase.grenton.com/en/negative-values-in-the-modbus-registers)
  
  
  
  
  
  
  Polski
  
  Pokaż podmenu do tłumaczenia
- [Nowe zgłoszenie](https://knowledgebase.grenton.com/pl/kb-tickets/new)
- [Portal klienta](https://knowledgebase.grenton.com/wsparcie)
- [Szkolenia](https://szkolenia.grenton.pl/)

[Szkolenia](https://szkolenia.grenton.pl/)

 Witaj. Jak możemy Ci pomóc?

- Brak sugerowanych wyników, ponieważ pole wyszukiwania jest puste.

1. [Baza wiedzy](https://knowledgebase.grenton.com/pl?hsLang=pl)
2. [Konfiguracja i Integracje](https://knowledgebase.grenton.com/pl/konfiguracja-i-integracje?hsLang=pl)
3. [Gate Modbus](https://knowledgebase.grenton.com/pl/konfiguracja-i-integracje?hsLang=pl#gate-modbus)

# Ujemne wartości w rejestrach Modbus

Aby odczytać ujemne wartości rejestrów Modbus, należy od odczytanej wartości z rejestru odjąć liczbę 65536.

Poniżej przykład jak można to wykonać:

1. Tworzymy zmienną użytkownika, do której zostanie przekazany wynik działania w skrypcie:

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

2. Następnie przygotujemy skrypt:

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

3. Skrypt będzie wywoływany przez zdarzenie OnChange w obiekcie wirtualnym Modbus:

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

4. Po wysłaniu konfiguracji, w cesze użytkownika powinna zostać zwrócona ujemna wartość:

![](https://knowledgebase.grenton.com/hubfs/Knowledge%20Base%20Import/s3.amazonaws.comcdn.freshdesk.comdatahelpdeskattachmentsproduction35149741813originalANhPWCJ9MQkfR_mXUDbTl1FbtVA21u8KKQ-1.png)  
![](https://knowledgebase.grenton.com/hubfs/Knowledge%20Base%20Import/support.grenton.plplsupportsolutionsarticles35000190973-ujemne-warto%C5%9Bci-w-rejestrach-modbushit-1.gif)

- [Wytyczne instalacyjne](https://knowledgebase.grenton.com/pl/wytyczne-instalacyjne?hsLang=pl#main-content)
  
  
  
  
  
    - [Jak Wykonać Instalację Elektryczną](https://knowledgebase.grenton.com/pl/wytyczne-instalacyjne?hsLang=pl#jak-wykona%C4%87-instalacj%C4%99-elektryczn%C4%85)
- [Urządzenia referencyjne](https://knowledgebase.grenton.com/pl/urz%C4%85dzenia-referencyjne?hsLang=pl#main-content)
  
  
  
  
  
    - [Zintegrowane urządzenia](https://knowledgebase.grenton.com/pl/urz%C4%85dzenia-referencyjne?hsLang=pl#zintegrowane-urz%C4%85dzenia)
- [Najczęstsze Błędy](https://knowledgebase.grenton.com/pl/najcz%C4%99stsze-b%C5%82%C4%99dy?hsLang=pl)
- [Instalacja Elektryczna](https://knowledgebase.grenton.com/pl/instalacja-elektryczna?hsLang=pl)
- [Konfiguracja i Integracje](https://knowledgebase.grenton.com/pl/konfiguracja-i-integracje?hsLang=pl#main-content)
  
  
  
  
  
    - [Gate Modbus](https://knowledgebase.grenton.com/pl/konfiguracja-i-integracje?hsLang=pl#gate-modbus)
    - [Videoszkolenia](https://knowledgebase.grenton.com/pl/konfiguracja-i-integracje?hsLang=pl#videoszkolenia)
    - [Aplikacje](https://knowledgebase.grenton.com/pl/konfiguracja-i-integracje?hsLang=pl#aplikacje)
    - [Gate HTTP](https://knowledgebase.grenton.com/pl/konfiguracja-i-integracje?hsLang=pl#gate-http)
    - [Smart Panel](https://knowledgebase.grenton.com/pl/konfiguracja-i-integracje?hsLang=pl#smart-panel)
    - [Konfiguracja](https://knowledgebase.grenton.com/pl/konfiguracja-i-integracje?hsLang=pl#konfiguracja)
    - [Interfejsy myGrenton](https://knowledgebase.grenton.com/pl/konfiguracja-i-integracje?hsLang=pl#interfejsy-mygrenton)
    - [Obiekty wirtualne](https://knowledgebase.grenton.com/pl/konfiguracja-i-integracje?hsLang=pl#obiekty-wirtualne)
    - [Gate Alarm](https://knowledgebase.grenton.com/pl/konfiguracja-i-integracje?hsLang=pl#gate-alarm)
- [Domofon](https://knowledgebase.grenton.com/pl/domofon?hsLang=pl)
- [Najczęściej Zadawane Pytania](https://knowledgebase.grenton.com/pl/najcz%C4%99%C5%9Bciej-zadawane-pytania?hsLang=pl#main-content)
  
  
  
  
  
    - [FAQ](https://knowledgebase.grenton.com/pl/najcz%C4%99%C5%9Bciej-zadawane-pytania?hsLang=pl#faq)
    - [O Grenton](https://knowledgebase.grenton.com/pl/najcz%C4%99%C5%9Bciej-zadawane-pytania?hsLang=pl#o-grenton)
- [Cenniki i dokumenty](https://knowledgebase.grenton.com/pl/cenniki-i-dokumenty?hsLang=pl)

[![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.