Discussion forum about Comet system products
You are not logged in.
Hi,
I am using T6540 connected on the ethernet with an IP assigned by the network administrator.
Using Matlab and creating TCP object I am sending queries from a PC to the connected logger device.
I am able to get the response from the device, similar to what one would get by using TSensor software ( that comes with the device).
Based on the analysis of the communication between the PC and the device using Wireshark network analyzer, we have observed that:
the modbus part of the header returns the values of two holding registers each time a query is generated by the PC.
Since the device measures four parameters namely, temperature, humidity, dew point and CO2 concentration, we would like to ask how these values are organized in the 4 bytes of information ( in the two holding registers)?
I am planning on using it as a lab experiment, to demonstrate the use of T6540 with TCP/IP using Matlab.
Please reply.
Best regards,
Puneet
Offline
Hi Puneet,
I am sorry, but I not understand your question. I am not able to help you with integration into Matlab. It is long time when I used Matlab during my studies. All important information about Modbus TCP implementation you find at user manual - please see: http://www.cometsystem.com/userfiles/fi … (6)5xx.pdf page 28. Do you know how looks Modbus query and response?
Jan
Offline
Hi Jan,
Thanks for the prompt reply.
Using Wireshark network analyzer tool one can look at the exchange of information between the PC on which it is installed and the connected devices.
This tool can also show the different parts of the frame such as Ethernet part, IP part , TCP and Modbus part of the info.
For example the query frame is 66 bytes long (modbus part 5 bytes long ) and the response frame(from the sensor) is 67 bytes long with the modbus part 6 bytes long.
We observed that the TSensor software running on the PC communicated with the sensor device (connected on the network) with four different addresses of holding registers ( possibly asking for the four parameters it measures).
The address of the four registers in hex format were: 08,0A,0C,0E.
This does not correspond to the hex addresses of the measured temperature, relative humidity,and CO2 concentration mentioned in the device manual.
The values read from the register at 08 (in hex) was 845A2580 (in hex).
Could you please tell how they are converted to the measured temperature value of 26.1 C (approx) ?
In other words, how can I translate the values of the four parameters measured by the device (in Hex) to their correct values (in the correct range).
I could not find a clear explanation in the manual.
Please reply.
Best regards,
Puneet
Offline
Hi,
I think that information inside manual are sufficient for implementation of communication with T6540. Sniffing communication between TSensor and device is really bad way. I don't know which Modbus registers use TSensor, I guess some proprietary registers. Way which make sense is look into Modbus TCP specification (http://www.modbus.org/docs/Modbus_Messa … _V1_0b.pdf) and for registers numbers into manual for T6540. Using Wireshark for reproducing communication is road to hell.
Just in brief:
- open TCP connection on port 502 (or different according set port) - send Modbus TCP request: 0x00 0x00 0x00 0x00 0x00 0x06 0x01 0x03 0x00 0x30 0x00 0x04 0x00 0x00 0x00 0x00 - transaction ID + protocol ID 0x00 0x06 - length of following bytes 0x01 - unit ID 0x03 - function code (read holding registers) 0x00 0x30 - register address (from manual for T6540) 0x00 0x04 - number of words (registers) for reading - wait for response - example of response: 0x00 0x00 0x00 0x00 0x00 0x0B 0x01 0x03 0x08 0x00 0xF3 0x01 0x58 0x00 0x4C 0x04 0xDF 0x00 0x00 0x00 0x00 - transaction ID + protocol ID 0x00 0x0B - length of following bytes 0x01 - unit ID 0x03 - function code (read holding registers) 0x08 - bytes count (=4x2) 0x00 0xF3 0x01 0x58 0x00 0x4C 0x04 0xDF - response data 0x00 0xF3 = 243 = 24.3°C (temperature) 0x01 0x58 = 344 = 33.4%RH (relative humidity) 0x00 0x4C = 76 = 7.6°C (dew point) 0x04 0xDF = 1247 = 1247ppm (CO2) - close TCP socket
Jan
Offline