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.

No response from modbus sensor when reading it after other modbus sensor [CR1000X]


Italo_ Aug 20, 2019 12:02 PM

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?


JDavis Aug 20, 2019 07:26 PM

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..


Sumant Lalljith Apr 14, 2021 10:55 AM

Hello.

I am trying to set up my CR1000x Datalogger to read from a sensor using the Modbus protocol. The sensor is RS485 and so I have connected to ports C5/C6. The serial parameters for the sensor are as follows: Baud Rate: 19200, Data Format: 8N1, Mod Addr: 27. I have written a simple code just to connect to the sensor and poll in 1 register to prove the connection.

------------------------------------

CRBasic Code

------------------------------------

Public MBresult

Public MBvar(2) As Long

BeginProg

SerialOpen(ComC5, 19200, 3, 0, 500, 4)

Scan(1000, mSec, 0, 0)

ModbusMaster(MBResult, ComC5, 19200, 27, 4, MBvar(1), 0, 1, 5, 100, 3)

NextScan

EndProg

------------------------------------

On execution of this code, the MBResult just increments indicating that the connection to the sensor is unsuccessful. I have tried playing around with the SerialOpen and ModbusMaster parameters, but nothing works. 

I have tried this with a Lufft WS601 sensor and a Solar Irradiance Sensor (Si-RS485TC-T-MB), and both sensors are working fine and I can view the registers using the sensors native config tools. The CR1000x just does not want to connect. Using the Device Config Utility tool, Terminal Window, I can see that the ComC5 port issuing the following output:

 opening 11
 hit ESC to exit, any other key to renew timeout

12:45:44.001 T 1B 04 FF FF 00 01 33 D4                          ......3.

12:45:46.001 T 1B 04 FF FF 00 01 33 D4                          ......3.

12:45:47.001 T 1B 04 FF FF 00 01 33 D4                          ......3.

12:45:48.001 T 1B 04 FF FF 00 01 33 D4                          ......3.

12:45:49.001 T 1B 04 FF FF 00 01 33 D4                          ......3.

12:45:50.001 T 1B 04 FF FF 00 01 33 D4                          ......3.

12:45:52.001 T 1B 04 FF FF 00 01 33 D4                          ......3.

12:45:53.001 T 1B 04 FF FF 00 01 33 D4                          ......3.

12:45:54.001 T 1B 04 FF FF 00 01 33 D4                          ......3.

12:45:55.001 T 1B 04 FF FF 00 01 33 D4                          ......3.
 Exiting sniffer

I have read as many forum related issues and also referred to the SerialOpen manual that indicates the following: If your sensor uses RS-422 or RS4-85, an interface such as the SDM-SIO1 will be needed. Refer to the SDM-SIO1 manual for additional format options beyond those specified in the CRBasic help.

Shouldn't I be able to communicate with the sensors on the ComC5 Port? I would appreciate some advice or guidance on this.

Looking forward to your feedback on this as soon as possible. Thank you.

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