I'm trying to read two modbus sensors (Datasol MET), but I get no response at the first attempt of reading the second sensor after the first.
Here's my main scan
BeginProg 'Main Scan SerialOpen(ComC5,38400,16,0,0,4) Scan(1,Sec,1,0) 'Default CR1000X Datalogger Battery Voltage measurement 'BattV' Battery(BattV) 'Default CR1000X Datalogger Wiring Panel Temperature measurement 'PTemp_C' PanelTemp(PTemp_C,60) ModbusMaster(CelResult1,ComC5,38400,1,3,Cel1,97,1,1,30,3) ModbusMaster(CelResult2,ComC5,38400,2,3,Cel2,97,1,1,30,3) 'Call Data Tables and Store Data CallTable Table1 NextScan EndProg
If I run this code in my CR1000X the first sensor will work fine (Cel1), but will never get response from the second sensor. If I change it to read 'Cel2' first and then 'Cel1', so I won't get response from 'Cel1', only 'Cel2'.
This issue can be solved if I set the 'Tries' to 2, but I don't think this is the optimal solution, since in every loop I will lost 300ms and these sensors will be in a much more time complex program, so every msec is important to not get skipped scan.
Has anyone experiencied this kind of issue? Is there any workaround?
I think it is a something particular to the sensors you have connected. On other projects, I have connected a lot of Modbus devices with no such trouble. Try adding a delay between the commands, and adjust it to find the minimum time between commands your sensors need..