LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabView serial communication issue

Solved!
Go to solution

Apologies, 

attached is the VI. I used '\n' as I assumed this is the termination character which labVIEW uses. For a cairrage return, i believe it is '\r'. I am new to labVIEW and what may seem as trivial to you, I might be experiencing it the first time. In the string in the front panel, I assume that there I will write the command such as as50 which means setting a setpoint as 50. But it does not read it in the read buffer. 

 

0 Kudos
Message 21 of 28
(300 Views)

I don't have the latest version of LabVIEW, can you save it for LabVIEW 2023 Q3 or older please?

 

Also as I said the typing two characters "\n" is not the same as a carriage return character. 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 22 of 28
(296 Views)

Absolutely, attached is the saved VI for 2020 version. I believe i managed to do it by adding a cairrage return character from the functions pallete. I am now reading it off the read buffer when i write in the string 'as50' and i can see the setpoint in my alicat device change. However, i am still getting the same error. Any suggestions on why? Maybe I have to add a while loop for the error to go away?

Also, what does this cairrage return character do exactly and how did it solve the issue. Thanks so much.

0 Kudos
Message 23 of 28
(289 Views)

Have you watched this video? It can solve most serial communication issues.

 

VIWeek 2020/Proper way to communicate over serial

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 24 of 28
(283 Views)

Yes I have watched this video on youtube. If it covers my problem, then i might have missed it. Thanks for the help. I can now control the device via LabVIEW. 

0 Kudos
Message 25 of 28
(280 Views)

Right click on that string constant where you have a "\n" inside. Look at which of the Display Modes is selected and you will notice that Normal Display has a checkmark in front. This means that your "\n" is sent as ... yes indeed ... the two characters '\' and 'n'. Your device thinks: "häää??? I don't know any command with these characters!!!"

 

Now right click again, and select '\' Codes Display. Ohhh look, your "\n" suddenly changes into "\\n". Remove one of the '\' characters. Now the "\n" actually means a <new line> character. If you enter a "\r" instead it means a <carriage return> character.

 

And to make it easier for you to later see again which display mode a string control/constant, has right click again on it and select Visible Items->Display Style. Ohhh look there is an additional glyph at the left side of the control showing you what display mode the string is using! You can even click on it and select the display mode from there!

Rolf Kalbermatter
My Blog
0 Kudos
Message 26 of 28
(257 Views)

@rolfk wrote:

Right click on that string constant where you have a "\n" inside. Look at which of the Display Modes is selected and you will notice that Normal Display has a checkmark in front. This means that your "\n" is sent as ... yes indeed ... the two characters '\' and 'n'. Your device thinks: "häää??? I don't know any command with these characters!!!"

 

Now right click again, and select '\' Codes Display. Ohhh look, your "\n" suddenly changes into "\\n". Remove one of the '\' characters. Now the "\n" actually means a <new line> character. If you enter a "\r" instead it means a <carriage return> character.

 

And to make it easier for you to later see again which display mode a string control/constant, has right click again on it and select Visible Items->Display Style. Ohhh look there is an additional glyph at the left side of the control showing you what display mode the string is using! You can even click on it and select the display mode from there!


I'm just going to put this out here. I made a Quick Drop plugin to set the display style for numerics and strings. In this case, you can open QD, type \ and hit Ctrl+5. That will set the display style to \ Codes and make the display style visible.

Quick Format 


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
0 Kudos
Message 27 of 28
(242 Views)

just to throw a curve ball: sometimes it helps to get a serial sniffer, some USB to RS232 device costs peanuts. And ioninja. Then look what is actually been sent. I was meant to extract data from some RS232 stream recently. It sends text and numbers. looked like $   432.5   0000 kg    333  so I used some string functions to get the 432.5 out of that stuff. Then converted to number.

0 Kudos
Message 28 of 28
(203 Views)