LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading and writing in serial port with a state machine

Solved!
Go to solution

Good afternoon.

I am new in LabVIEW, and I'm having trouble processing the data read from the serial port. The purpose of the VI would be to have a state machine that sends something through the serial port, and then it goes to a next state in which it reads the serial port and compares if the response message fits with the one it has established to go to the next state. The program seems to write and read the serial port, but when comparing the read message with the reference one, it does not consider them equal, even though they are.

If anyone knows why this is the case, I would greatly appreciate the help. I attached the VI for reference

 
 
 


 
0 Kudos
Message 1 of 4
(1,428 Views)

I'm seeing a lot of red flags here.  At this point, I'm just going to recommend you go watch this video: VIWeek 2020/Proper way to communicate over serial


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 4
(1,403 Views)
Solution
Accepted by topic author d_hunter13

I am on a mobile and cannot see your code.

 

I hear you say "Two strings look the same"  String objects like constants, controls and indicators have a display property that can be shown from right-clicking the object.  Many ASCII coded characters are considered white space and do not appear in text objects unless you ask to show them.


"Should be" isn't "Is" -Jay
Message 3 of 4
(1,387 Views)

Thank you! I already fixed it an that was one of the problem that the program had.With every command, it also returned \r\n and I wasn´t  watching it.

0 Kudos
Message 4 of 4
(1,355 Views)