09-01-2021 01:11 PM
Hello all!
I'm trying to communicate with a CO2 Sensor via RS232 Com Port, writing commands via Modbus UART. I couldn't make the sensor work (read) via LabView but I confirmed that the sensor works with a developer software from the manufacturer, so the hardware connection looks to be working. Attached is my VI trying to communicate sending a command to read CO2 PPM and the Application note/command summary for this sensor.
I really appreciate any help or guide.
Best regards and greetings from Mexico!
09-01-2021 01:29 PM
Two errors:
1) Disable the termination char.
2) You need to calculate and add the CRC to your command string.
I strongly recommend to download and use one of the many available MODBUS API, like the one from NI or the excellent Plasmionique Modbus Master API instead of inventing the protocol by yourself.
Regards, Jens
09-01-2021 01:32 PM - edited 09-01-2021 01:33 PM
Hi eduardo,
there are several bugs in your VI:
Edit: Jens basically gave all the same suggestions… 🙂
09-02-2021 04:51 PM
Hi Gerd & Jens, really thank you for your response and help.
I'm sorry for the rookie mistakes, I'm starting learning LabVIEW.
I calculated the CRC as showed below for 1504138B0001 and it would be 15 04 13 8B 00 01 70 46
I downloaded the NI Modbus library but I have no experience using them, but I'm researching how to use the recommended from Jens. I tried to make a new code with LV NXG because at the end I want to make the VI with NXG features, but right now I only want to have a successful reading.
Here is the VI, I disabled the termination char and connect it directly to a string terminal to see whatever response it could receive. For some reason, NXG is not detecting my COM port, as Labview 2018 has no problems detecting it. I'm currently installing NI-VISA drivers again.
Thank you all!
I attached the command summary PDF, I think it didn't upload on my first publication.
Best regards!