LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW reads extra serial characters that Putty doesn't?

I'm communicating with a pcProx RFID reader. If I open a COM port in Putty and hit "Enter" a few times I see:

 

RF IDeas>

RF IDeas>

RF IDeas>

RF IDeas>

RF IDeas>

 

If I send "Enter" (\n) using the serial communication vi's I read:

 

RF IDeas>

 

RF IDeas>

 

RF IDeas>

 

RF IDeas>

 

RF IDeas>

 

 

I set the indicator to \ codes and I'm getting:

 

\n\r\nRF\sIDeas>\n\r\nRF\sIDeas>\n\r\nRF\sIDeas>\n\r\nRF\sIDeas>\n\r\nRF\sIDeas>\n\r\nRF\sIDeas>

 

If I paste the text from the Putty window:

 

RF\sIDeas>\nRF\sIDeas>\nRF\sIDeas>\nRF\sIDeas>\nRF\sIDeas>\nRF\sIDeas>\nRF\sIDeas>

 

I've tried enabling/disabling termination characters, different termination characters.  I've changed a few settings in Putty but it's always the same.  I want to believe Putty is treating those \ characters differently and LabVIEW is just showing what is really coming accross, or Putty sends something other than \n when I hit "Enter" but I've googled about and can't figure it out?

 

 I've attached the a vi, but it's just a quick simpler version to make sure it wasn't something else in the bigger vi causing this.  I don't think it's the code.  Any serial read I do in LabVIEW does the same thing.

 

0 Kudos
Message 1 of 6
(3,502 Views)

Putty is likely converting the termination for you for display purposes.

 

When you use character based communications with a system that is based on a different OS, you will often have this problem.

 

Us the Normalize End of Line VI to adapt strings that come from an system type other than your LabVIEW environment (usually Windows)

 

http://zone.ni.com/reference/en-XX/help/371361L-01/glang/normalize_end_of_line/

 

 


Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.

"You are what you don't automate"
Inplaceness is synonymous with insidiousness

Message 2 of 6
(3,481 Views)

So even using the Normalize end of line.vi, it looks the same.  I tried every option, but even when it changes the end of line it has enough for an extra line between the prompts.

0 Kudos
Message 3 of 6
(3,469 Views)

PuTTY emulates Linux. Linux interprets \r as a "new line" and \n as a "new line". In Linux, when you press the enter key, what's really happening is you're inserting a \n character. On Windows, pressing the enter key inserts a \r\n, which is read on PuTTY as two newline characters. Try sending \n, just make sure that your string is set to use \ codes and not normal display:

 

0 Kudos
Message 4 of 6
(3,446 Views)
When I hit enter on my win 7 PC, I get just a \n in a string control. I am only sending \n anyway if you check the attached vi. Plus, if I'm reading what you said correctly shouldn't Putty be showing the extra line and not LabVIEW? I haven't tried sending a \r. I think it has to be either Putty sends something other than a \n when I hit enter, or its changing \n\r\n to just a \n for some reason.
Message 5 of 6
(3,420 Views)

As I said, the Unix newline char is just \n. When the RFID card responds, it might simply be responding appropriately to the source of the message; LabVIEW coming from Windows dictates it responds with \r\n, PuTTY coming from Windows dictates it doesn't respond with anything. I'm not 100% though, as your VI is too new for my version of LabVIEW. If you can save it for LV 2013, I could be more helpful.

 

edit: additionally, where are you reading these responses? In PuTTY/from a VISA Read?

0 Kudos
Message 6 of 6
(3,415 Views)