Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

MODBUS DATA BADLY SAVED CR350


ronaldotukchro May 28, 2024 10:04 PM

Hello everyone,
I have a Rika brand sensor, RK520-11 with RS485 output, using the following program I can read data but not the data I should.

Public BattV
Public PTemp_C
Public Temp, Moisture, EC, pH
Public ResultCode(5)

Units BattV=Volts
Units PTemp_C=Deg C

DataTable(minutal,True,-1)
  DataInterval(0,60,Sec,10)
  Minimum(1,BattV,FP2,False,False)
EndTable

BeginProg
  SerialOpen(Com2,9600,3,0,50000,4)
  Scan(10,Sec,1,0)
    Battery(BattV)
    PanelTemp(PTemp_C,60)
    
    ModbusMaster(ResultCode(1),Com2,9600,1,3,Temp,1,1,2,100,1)
    ModbusMaster(ResultCode(2),Com2,9600,1,3,Moisture,2,1,2,100,3)
    ModbusMaster(ResultCode(3),Com2,9600,1,3,EC,3,1,2,100,3)
    ModbusMaster(ResultCode(4),Com2,9600,1,3,pH,4,1,2,100,3)

    Delay (0,500,mSec)
    CallTable minutal
  NextScan
EndProg

 What do I mean by not real data, that the result of the data is extremely small, for example: 2.176568e-38, etc.
When I read the sensor data via modbus poll, I see integers (successful reading).What I have realized is that if in modbus poll, I view the data with the 32 bit float big-endian format, I see the same value that the datalogger gives me: 2.176568e-38. (but if I view the data as "signed" in modbus poll, I see an integer: 221) Finally, the value that I want to record in the datalogger is "221" and not "2.176568e-38".
How could I save the data that way? I was looking at the MoveBytes instruction but I can't do it.

Any help would be greatly appreciated.
Greetings!

Log in or register to post/reply in the forum.