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.

Serial ModBus communication between sensor and CR1000X


Technician Sep 23, 2022 01:50 PM

I'm trying to use the digital interface of the temperature and humity probe "Rotronic HygroClip2 Advanced Series HC2A-S3" with the CR1000X.

Datasheet of the probe:

https://www.alphacontrols.com/Multimedia/www.alphacontrols.com/Files/ProductCategory/330/Manual.pdf

After trying multiple different protocols, setups and functions within CRBasic, I've finally managed to get a response from the probe when I send a "Data request". 

The probe is setup to use Modbus-protocol and according to the digital chip in the probe, 

https://prodc5fe4b8-pic4.ysjianzhan.cn/upload/E-M-AC3000-CP_20.pdf (Modbus protocol)

The probe needs to recive the command:

:0103CRLF

To respond with the sensor data in the from:

:010306015E04CE042B96CRLF

Currently when using the sniffer mode in the terminal emulator in Loggernet, I'm able to see that my data request command is send correctly, but the response I recive is not in the expected form. 

I've also tried to use the dedicated modbus functions within the CRBasic editor, but using them I get no response in the sniffer mode.

Bellow is the data from the Terminal emulator in Loggernet and the code running on the CR1000X:

Terminal Emulator:

CR1000X>
CR1000X>W

1: ComRS232
2: ComME
3: Com310
4: ComSDC7
5: ComSDC8
6: Com320
7: ComSDC10
8: ComSDC11
9: ComC1
10: ComC3
11: ComC5
12: ComC7
13: ComUSB
15: TCP/IP
16: SDM-SIO4
17: Ethernet
22: USB network
23: IP Trace
32..47: SDM-SIO1
Select: 11

ASCII (Y)? Y

opening 11

hit ESC to exit, any other key to renew timeout

10:44:47.003 T :0103
10:44:47.039 R .....6.v...{}ssss....
10:44:54.003 T :0103
10:44:54.038 R .....6.v...{}ssss....
10:45:01.003 T :0103
10:45:01.038 R .....6.v...{}ssss....
10:45:08.003 T :0103
10:45:08.038 R .....6.v...{{ssss.s..
10:45:15.003 T :0103
10:45:15.039 R .....6.v...{{ssss.s..
10:45:22.003 T :0103
10:45:22.039 R .....6.v...{}ssss....
10:45:29.003 T :0103
10:45:29.039 R .....6.v...{}ssss....

CRBasic code: 

'Declare Public Variables 
Const CR = CHR(13)
Const LF = CHR(10)
Const CRLF = CHR(13) + CHR(10)
Public PTemp, batt_volt,ModbusData(20),Result, RETURNED
Public RX As String * 100

'Define Data Tables
DataTable (Test,1,-1)
  DataInterval (0,15,Sec,10)
  Minimum (1,batt_volt,FP2,0,False)
  Sample (1,PTemp,FP2)
  Sample (1,ModbusData(),FP2)
  Sample (1,Result,UINT2)
  Sample (1,RX,String)
EndTable

'Main Program
BeginProg
  SerialOpen(ComC5,19200,16,1,10000,4)
  SerialFlush(ComC5)
  
  Scan (1,Sec,0,0)
    PanelTemp (PTemp,15000)
    Battery (batt_volt)
    SerialOut (ComC5,":0103"+CRLF,CHR(58),1,200)
    SerialInRecord(ComC5,RX,58,0,&H0D0A,RETURNED,10)
    
    'Retrieve Modbus Data
    'ModbusMaster (Result,ComC5,19200,01,03,ModbusData(),1,0,1,50,0)   

    'Enter other measurement instructions
    'Call Output Tables
    CallTable Test
  NextScan
EndProg

 

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