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.

Modbus with CR1000X


chalit Feb 28, 2020 08:52 AM

Hi,

I connect CR1000X and open ComC5 port as RS485 for incoming data of modbus device:

I didnt send any command to this modbus device, it will issue the data every 15min as see in the terminal of logger as below:

15:18:55.251 R 0D 0A 0D 0A 53 63 61 6E 20 53 65 6E 73 6F 72 20 ....Scan Sensor
15:18:55.251 R 44 61 74 61 3A 09 32 30 2D 30 32 2D 32 38 2D 35 Data:.20-02-28-5
15:18:55.251 R 09 31 35 3A 31 39 3A 30 30 09 40 52 52 43 44 0D .15:19:00.@RRCD.
15:18:55.251 R 0A .
15:18:56.311 R 32 2D 32 09 2-2.
15:19:03.130 R 58 2D 30 32 2E 31 33 30 35 09 59 2D 30 30 2E 39 X-02.1305.Y-00.9
15:19:03.130 R 32 33 33 09 54 2B 33 33 2E 37 32 09 56 2B 30 33 233.T+33.72.V+03
15:19:03.130 R 2E 33 32 09 49 0D 0A .32.I..
15:19:03.644 R 33 2D 33 09 3-3.
15:19:10.463 R 58 2D 30 32 2E 30 38 39 31 09 59 2D 30 30 2E 38 X-02.0891.Y-00.8
15:19:10.463 R 37 35 36 09 54 2B 33 37 2E 36 32 09 56 2B 30 33 756.T+37.62.V+03
15:19:10.463 R 2E 33 32 09 49 0D 0A .32.I..
15:19:10.978 R 34 2D 34 09 4-4.
15:19:17.797 R 58 2D 30 30 2E 31 32 39 39 09 59 2D 30 30 2E 30 X-00.1299.Y-00.0
15:19:17.797 R 34 35 37 09 54 2B 33 32 2E 33 32 09 56 2B 30 33 457.T+32.32.V+03
15:19:17.797 R 2E 33 32 09 49 0D 0A .32.I..
15:19:18.319 R 53 63 61 6E 20 6F 76 65 72 0D 0A Scan over..

Can you recommend the CR1000X instruction for capture these data in the datalogger variable, there are 3 sensors are 2-2, 3-3 and 4-4

Thanks for advise:


JDavis Feb 28, 2020 09:56 PM

 First of all, that data does not look like the Modbus protocol. It appears to be a manufacturer specific ASCII data format.

The first step is reading in a line of data. I recommend SerialInRecord() to get all bytes between line feed from the end of the previous line of data and carriage return at the current line of data.

Public NBytesReturned As Long
Public DataString As String * 64

SerialInRecord (ComC5,DataString,10,0,13,NBytesReturned,11)

 Then, use InStr() to search for your sensor identifier in the beginning of the data string. If it is not the string you are looking for, InStr() returns 0.

The data string will need to be split into separate values. The split option 0(numeric) will probably work. Do take into account that the 32 and numbers from the sensor identifier will appear in the first values of the split results in the array.


chalit Mar 1, 2020 05:21 AM

Thank you, it wotk out fine. 

Chalit​ I. 

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