02-01-2022 02:52 PM
Hi I am working with a simple state machine that I use to monitor CO2 gas in the air. I am using VISA serial communication, and the issue I have is that when I am trying to use another read buffer for the second state in my SSM the unflatten from string error 74 occurs preventing me from reading any data. I am using the same structure I used to read the data in the default state. I have searched the message boards, but have been unable to find a solution.
I am also having an issue with the sensor responses outputting to my graph that I would like to prevent from happening. When I send a new command to the sensor the output response is graphed instead of ignored. How do I suppress the response?
All suggestions for improvement are welcome.Thanks
02-01-2022 04:08 PM
What does the string data look like when unflatten is successful compared to when it has an error? Is the VISA read timing out when you get the error?
If there certain data you don't want to go to the graph, you will have to check for it and filter it out.
02-02-2022 10:14 AM
It is a Hex String of two bytes. I have attached what it looks like from the front interface when in the sample gas ppm state.
02-02-2022 10:25 AM
Since you are using a Raw/Hex/Binary protocol, you need to disable the Termination Character. It is on by default from the VISA Configure Serial Port. When it is enabled, the read will stop when a Carriage Return (0xA) is read. This can happen quite often with a Raw/Hex/Binary protocol. So just wire a FALSE constant to the "Enable Termination Character" input on the top of the VISA Configure Serial Port.
02-02-2022 01:57 PM - edited 02-02-2022 02:23 PM
Hi Crossrulz,
So I did some reading on the termination character. If my understanding is correct, then the reason my issue occurred was that the termination character bytes and one of the bytes I was trying to read are the same and therefore the read operation is aborted and then no data or incomplete data was sent to the unflatten from string function?
Also, my CRC for the status check command in the inner while loop was incorrect as well, but I made the change as suggested and I am still having the same error. I have attached the updated code with the proper CRC added.