05-19-2016 12:32 PM - edited 05-19-2016 12:33 PM
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.
05-19-2016 02:29 PM - edited 05-19-2016 02:29 PM
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/
05-19-2016 02:50 PM
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.
05-19-2016 04:52 PM
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:
05-19-2016 11:20 PM
05-19-2016 11:28 PM - edited 05-19-2016 11:31 PM
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?