Hi everyone
I have a CR6 Datalogger and I tried to stablished a Modbus TCP/IP communication, configurating the CR6 as Server and using ModbusPoll in my PC as Client. But, a problem appered in the ModbusPoll, it was "02 Illegal Data Address". I look in the forum for solutions but i couldn't get anything.
So I hope someone could help me.
This is my Code:
Public PTemp, batt_volt, analog_meas
Public ModbusRegisters(3)
Public ModbusCoil As Boolean
'Data Table Definition
DataTable (Table1,1,-1)
DataInterval (0,10,Min,10)
Minimum (1,batt_volt,FP2,0,False)
Average (1,PTemp,FP2,False)
Average (1,analog_meas,FP2,False)
EndTable
'Main Program
BeginProg
'Configure the datalogger as a Modbus Server
ModbusServer (502,0,1,ModbusRegisters(),ModbusCoil,0)
Scan (1,Sec,0,0)
'Measure the datalogger panel temperature
PanelTemp (PTemp,250)
'Measure the battery voltage
Battery (batt_volt)
'Measure an analog voltage
VoltSe (analog_meas,1,mV5000,1,1,0,_60Hz,1.0,0)
'Populate Modbus Registers
ModbusRegisters(1) = PTemp
ModbusRegisters(2) = batt_volt
ModbusRegisters(3) = analog_meas
'Call final storage table
CallTable Table1
NextScan
EndProg
Illegal data address means the software requested a register number that is not mapped.
I think by default, ModbusPoll requests 10 or more registers. Don't request more than the first 6 registers.