02-23-2023 11:03 AM
Hello everybody.
I'm having trouble reading a sensor through the serial port. I can read through a MATLAB script, provided by the sensor developer, but when I try to read through LabVIEW I get an error message referring to timeout.
Error -1073807339 occurred at VISA Read in Untitled 1
Possible reason(s):
VISA: (Hex 0xBFFF0015) Timeout expired before operation completed.
On line 26 of the script is the command to read the sensor characteristics as specified Header 170 header 85 slave ID 1 function code 16 service 1 CRC hi 176 CRC 20 The expected correct answer is a 368x1 vector of double
Glad for any help.
Tanks in advance.
02-23-2023 12:31 PM
Hi
You did almost an OK job.
But you probably have to use enable end char so it stops on a received linefeed.
Because that is what I read in Matlab.
And because of the end char as defined as CR/LF I think you have to add that to the string to be sent.
Finally you have in the disabled node an array of I32 but that should probably be an array of U8.
Good luck
I added a vi of how it would look at my place without all the stuff not really needed. But I'm not sure.
02-27-2023 12:01 PM
Hello Albert. Thanks for your reply.
I eventually did the communication to work. In a moment of epiphany, I created a typecast from a U8 array to a string and send it to the COM port. It did the magic!
Curiously, it works with and without the CR/LF as TRUE.
I attached the working VI. Now I need to implement the other functions, i.e., for sensor configuration and for data acquisition. This one just get the sensor information.
I had the chance to know Amsterdam and Eindhoven, beautiful cities and country.
Once again, thanks for your time.
Greetings from Brazil.
02-27-2023 04:35 PM