I have a inclinometer sensor with a RS485 output and I want to read data from it using a CR800+MD485.
This is the sensor: https://www.leveldevelopments.com/wp/wp-content/uploads/documents/SOLAR-2_Dual_Axis_Inclinometer.pdf
I tried to create a program using Short Cut, but so far I had no success reading data from sensor.
This is the program generated by Short Cut
'CR800 Series 'Created by Short Cut (3.2) 'Declare Variables and Units Public BattV Public PTemp_C Public ModbusResult Public Modbus(1) Units BattV=Volts Units PTemp_C=Deg C 'Define Data Tables DataTable(Table1,True,-1) DataInterval(0,5,Sec,10) Sample(1,ModbusResult,FP2) Sample(1,Modbus(1),FP2) EndTable DataTable(Table2,True,-1) DataInterval(0,1440,Min,10) Minimum(1,BattV,FP2,False,False) EndTable 'Main Program BeginProg 'Main Scan Scan(5,Sec,1,0) 'Default CR800 Datalogger Battery Voltage measurement 'BattV' Battery(BattV) 'Default CR800 Datalogger Wiring Panel Temperature measurement 'PTemp_C' PanelTemp(PTemp_C,_60Hz) 'Modbus Master Instruction ModbusMaster(ModbusResult,COMSDC7,115200,100,3,Modbus(),1,1,3,100,2) 'Call Data Tables and Store Data CallTable Table1 CallTable Table2 NextScan EndProg
All that I get is '0' on Modbus() and ModbusResult just keep increasing by '1' at every scan.
I think the problem can be on baudrate configuration, because the baudrate of sensor is 38400, but I tried to change the argument of ModbusMaster to 38400/-38400/-115200 and I keep getting the same result.
The sensor is OK and I can get data from it using a RS485 adapter and a terminal software on PC.
Anyone have some tip?
Regards
If you are using an MD485, you need to change the baud rate on the RS485 setting tab of the MD485 to match the baud rate of the sensor. The RS232 baud rate on the MD485 should match the baud rate in your ModbusMaster instruction.
Hello JDavis,
now, after some modifications, I can see the correct command at the output of MD485 and the correct response of the sensor.
But I can't understand how the data is stored.
My ModbusMaster is
ModbusMaster(ModbusResult,COMSDC7,38400,100,3,Modbus(),1,1,3,100,1)
The variables are declared and saved as
Public ModbusResult Public Modbus(1)
DataTable(Table1,True,-1)
DataInterval(0,5,Sec,10)
Sample(1,ModbusResult,FP2)
Sample(1,Modbus(1),FP2)
EndTable
MD485 sent '64 03 00 00 00 02 cd fe' to the sensor.
And the sensor response is something like '64 03 04 00 00 03 59 0f ff'. But nothing is recorded at the variable Modbus.
How to declare the variables to record the data? The response is a 32 bit signed integer.
Your timeout on ModbusMaster might be too short. In the terminal you were watching, check to see how long it took the sensor to respond.
Hi JDavis or Italo
I have the same problem, I need to communicate between CR800 (master) and IOZone 560 device (slave) by means of RS485 and Modbus Protocol. My physical connections are:
PC <<==RS232==>> CR800 <<==CSI/O (SDC7)==>> MD485 <<==RS485==>> IOZone 560 device
Connection between MD485 and IOZone 560 device: G to shield, A to Next(-) and B to Next(+)
Configuration of MD485 is: Active ports=CSI/O and RS485; Mode= SDC Address7; Protocol= Packbus Networking; RS485: 9600, None, 8 bits, 1 bit.
Configuration CR800 is: Comport: RS-232, 9600 auto,
Configuration IOZone 560: 9600, None, 8 bits, 1 bit.
The program is:
'CR800 Series
'Created by Short Cut (3.2)
'Declare Variables and Units
Public BattV
Public PTemp_C
Public ModbusResult
Public Modbus(6) As Long
Units BattV=Volts
Units PTemp_C=Deg C
'Define Data Tables
DataTable(Table1,True,-1)
DataInterval(0,15,sec,10)
Average(1,BattV,FP2,False)
Average(1,PTemp_C,FP2,False)
Sample(1,ModbusResult,FP2)
Average(1,Modbus(1),FP2,False)
FieldNames("MB_AVG_1")
Average(1,Modbus(2),FP2,False)
FieldNames("MB_AVG_2")
Average(1,Modbus(3),FP2,False)
FieldNames("MB_AVG_3")
Average(1,Modbus(4),FP2,False)
FieldNames("MB_AVG_4")
Average(1,Modbus(5),FP2,False)
FieldNames("MB_AVG_5")
Average(1,Modbus(6),FP2,False)
FieldNames("MB_AVG_6")
EndTable
'Main Program
BeginProg
'Main Scan
Scan(5,Sec,1,0)
'Default CR800 Datalogger Battery Voltage measurement 'BattV'
Battery(BattV)
'Default CR800 Datalogger Wiring Panel Temperature measurement 'PTemp_C'
PanelTemp(PTemp_C,_60Hz)
'Modbus Master Instruction
ModbusMaster(ModbusResult,ComSDC7,9600,1,3,Modbus(),1,6,3,100,2)
'Call Data Tables and Store Data
CallTable Table1
NextScan
EndProg
My results are: ModbusResult just keep increasing by '1' at every scan and the Modbus() array, all are "0".
I used the IOServer emulator to test the IOZone device, the result was successful. The same test with the CR800, this case in slave modus, the result was successful.
Anyone have some tip?
Regards
The MD485 needs to be set to Transparent protocol.