Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple termination characters in serial commands

I'm using LabVIEW and RS 232/serial connections to control a PipeJet manufactured by Biofluidix. Attached is my code, as well as documentation from the company (serial control starts on page 18). I'm using a straight through RS 232 cable to connect the instrument to the serial port at the back of the computer. I already checked, and there's no instrument driver.

 

Whenever I use NI MAX to see the instrument, it confirms that the instrument is present and usable. However, I am unable to send/receive commands to it. Maybe it's because I can't seem to send both termination characters in NI MAX? (Look a few lines later at termination characters) Whenever I use the attached code to write a "v" command and read the response, I get an error, I believe the code is -1073807339, where the issue occurs in the read VISA command. This makes me think that I'm not sending commands correctly. According to the documentation, the baud rate is 9600, stop bits 1, no parity, and 8 data bits. The only other software issue I can think of is either the way the termination characters are being handled, and/or I need to insert a time delay for the Read command.

 

The documentation says the termination characters are CR LF, so in my code I wired the termination character as "False" for the Configure Serial Port Node, and for VISA Write I am instead using Concatanate String to send "v" as well as the End of Line constant together to Write. The only issue arises with the read command; simply opening/closing the instrument doesn't seem to contain errors.

 

Tomorrow at work, I will try debugging this further with the Basic Serial Read and Write vi and will report on my results. Any ideas?

 

0 Kudos
Message 1 of 3
(4,545 Views)

You need to turn on the Termination Character.  By default, the Termination Character is only used for the read.  So since the message ends with a CR LF, you want your Termination Character to be a LF (0xA), which is the default.  So your code can be reduced to this.


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 2 of 3
(4,530 Views)

Adding the end of line constant is almost OK. If your operating system is windows.

You can look at the string by either placing an indicator at the frontpanel and set the display on HEX or '\' codes display by rightclicking on the indicator.

 

You probaly have to add both \r and \n to have cr and lf.

 

greetings from the Netherlands
0 Kudos
Message 3 of 3
(4,526 Views)