I am using below program to use two wind sensor having modbus ouput to CR800. the logger read only ID 0 ( decimal48), but not ID 1 (decimal49)
'CR800 Series Datalogger
'DAS Program for Automatic weather station consisting of :
'Wind speed and wind direction sensor (Ultrasonic)
SequentialMode
'Declare Public Variables
'Example:
Public PTemp, batt_volt
Public Register1(6) As Long 'For Ultrasonic Wind Speed and Direction sensor
Public Result1, Result2 'For Ultrasonic Wind Speed and Direction sensor
Public Register2(6) As Long
Alias Register1(1)= WD1_min
Alias Register1(2)= WD1_avg
Alias Register1(3)= WD1_max
Alias Register1(4)= WS1_min
Alias Register1(5)= WS1_avg
Alias Register1(6)= WS1_max
Alias Register2(1)= WD2_min
Alias Register2(2)= WD2_avg
Alias Register2(3)= WD2_max
Alias Register2(4)= WS2_min
Alias Register2(5)= WS2_avg
Alias Register2(6)= WS2_max
'Declare Other Variables
'Example:
'Dim Counter
'Define Data Tables.
DataTable (Weather_Data,1,-1)
DataInterval (0,0,Min,10) ' Data storage time
Minimum (1,batt_volt,FP2,False,False)
Sample (1,PTemp,FP2)
Sample (6,Register1(),UINT2)
Sample (6,Register2(),UINT2)
EndTable
'Main Program
BeginProg
Scan (5,Sec,0,0)
PanelTemp (PTemp,250)
Battery (batt_volt)
'Code to read wind speed and wind direction sensor
SerialOpen (Com1,19200,0,0,50)
ModbusMaster (Result1,Com1,19200,48,3,Register1(),0001,6,3,100,3) 'sensor having MODBUS Address 0
Register1(4)= (Register1(4)/10)*3.6
Register1(5)= (Register1(5)/10)*3.6
Register1(6)= (Register1(6)/10)*3.6
SerialClose (Com1)
Delay (1,1,Sec)
SerialOpen (Com1,19200,0,0,50)
ModbusMaster (Result2,Com1,19200,49,3,Register2(),0001,6,3,100,3) 'sensor having MODBUS Address 1
Register2(4)= (Register2(4)/10)*3.6
Register2(5)= (Register2(5)/10)*3.6
Register2(6)= (Register2(6)/10)*3.6
SerialClose (Com1)
CallTable Weather_Data
NextScan
EndProg
From ModbusMaster Help:
"The Modbus address of the device. Valid range is 1-255 (excluding 189, which is the PakBus sync byte). Address 0 is a broadcast address."
Change sensor addresses to 1 and 2.
Try putting one SerialOpen instruction between BeginProg and Scan. It's ok to leave the port open.
Remove the SerialClose and the delay statements, it's not required.
Good Luck