09-25-2024 09:14 AM
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.
09-25-2024 09:20 AM - edited 09-25-2024 09:23 AM
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.
09-25-2024 09:25 AM
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.
09-25-2024 09:39 AM
Have you watched this video? It can solve most serial communication issues.
VIWeek 2020/Proper way to communicate over serial
09-25-2024 09:41 AM
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.
09-25-2024 10:31 AM - edited 09-25-2024 10:35 AM
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!
09-25-2024 11:15 AM
@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.
09-26-2024 09:43 PM
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.