I spent some time using the Modbus Poll utility and have discovered what is happening when the RTS Outdoor Temperature register MB_REG181 (ref: 03ModbusBacnetRegistersList.xls) is is being written to. I also spent some time to create a program to get around the weirdness and can now successfully (most of the time) display the outdoor temp on the RTS. Yay!
When the register is written to, the existing value is bit shifted left 8 bits, then the new value is inserted using a bitwise ‘or’ function. I don’t know why this occurs - it doesn’t seem to happen with other registers.
Here’s an example using hex notation:
original value 0x00fa (integer value 250, showing on the RTS 25.0)
new value written 0x0103 (integer value 259)
when the value is written, the original value gets shifted left 8 bits (to 0xfa00)
then the new value is concatenated with bitwise 'or'
so 0xfa00 | 0x0103 => 0xfb03 (integer value -1277, showing on the RTS -127.7)
the next value written will be concatenated with bitwise 'or' to 0x0300
The only way I found around this is to first write 0x0 to clear the lower 8 bits, then write the temperature I actually want displayed. An incorrect value will briefly show, but if we quickly write 0x0, then the value, and finally wait before refreshing the display, then the correct value will be displayed most of the time.
It’s a fairly ugly workaround, but it works!
40 REM OUTDOOR TEMP
50 REM WHEN WE WRITE TO REG181 IT SHIFTS LEFT ONE BYTE, THEN OR'S WITH VALUE SENT
60 REM EG IF EXISTING VALUE IS 0X1234, THEN 0XABCD IS SENT
70 REM RESULT IS 0X3400 | 0XABCD == 0X20CD
80 RTS_OT_NOW = INT ( IN1 * 10 )
90 IF 0.500 > ABS ( CNT ) AND 0.500 < ABS ( RTS_OT_NOW - RTS_OT ) THEN Z = 1 ELSE Z = 0
100 IF Z THEN 1.10.MB_REG181 = 0
110 IF Z THEN 1.11.MB_REG181 = 0
120 IF 0.500 > ABS ( CNT ) AND NOT Z THEN CNT = 60
130 IF -0.500 > CNT THEN Z = 1 ELSE Z = 0
140 IF Z THEN 1.10.MB_REG181 = RTS_OT_NOW
150 IF Z THEN 1.11.MB_REG181 = RTS_OT_NOW
160 IF Z THEN RTS_OT = RTS_OT_NOW
170 IF Z THEN CNT = 60
180 CNT = MIN ( CNT - 1 , 60 )
220 REM RUN EVERY SECOND EXCEPT WHEN UPDATING OUTDOOR TEMP
230 IF NOT Z THEN WAIT 0.01
I hope this helps someone else.