From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

detect initializaton and termination charactes in VISA

I'm working with VISA functions. The picture that I show is part of my vi, and woks fine. There are a subvi (ERROR ?) that detect a message incomplete (If the message that I wrote, it had 200 characters, I recived the message with 123 characters, e.g.). This is the reason that I inserted a flat sequence structure, to read a complet message.
The subvi "ERROR ?" detect initialitation and termination chatacter of each message... and I have found a "function" of NI very similar in poprerty node: termination character. Someone have a idea about this function? I better change my subvi by this property node?
 
Thanks, and sorry for my english... 😉
 
vicen
 
WinXP / LV7.1
0 Kudos
Message 1 of 11
(3,599 Views)
There is the VISA Property  Message Based Settings:Termination Character Enable. When this is true, the VISA Read will automatically terminate when a termination character is detected. Even if you specify some large number of bytes to read, it will terminate. With this, you do not need to use VISA Bytes at Serial Port to determine how many bytes are available or check to see if the serial port buffer is empty or read the retruned data to see if the character is there. You can specify the termination character with the Message Based Settings:Termination Character property. This is a U8 input. If you want to terminate on a LF, that is x0A and that would be the value you write to the property node.
Message 2 of 11
(3,587 Views)
I think I need to use "bytes at port" because I unknown how many bytes I will read. The main objective of my 'vi' is to receive the whole message. The process is this: I send a message (a request) and it writes in VISA. I will receive the message reply (lengh unknown) with "write" VISA. If this message are complete I send another message. Sometimes I receive messages incomplets. It solves increasing time delay, but if I'm working in miliseconds I'm sure I'm losing time because if I read a short message I don't need as much time as when I read a large message.
As I've said later, my 'vi' works fine, but I think the 'vi' could be improved. Possibly using Termination character?
0 Kudos
Message 3 of 11
(3,566 Views)
I said:
"The process is this: I send a message (a request) and it writes in VISA. I will receive the message reply (lengh unknown) with "write" VISA."
 
I want to say:
 
"The process is this: I send a message (a request) and it writes in VISA. I will receive the message reply (lengh unknown) with "read" VISA."
Smiley Tongue
0 Kudos
Message 4 of 11
(3,562 Views)
Did you understand Dennis' message? If you set the number of characters to read to a number larger than your longest possible message AND set the VISA Read to halt on recepit of the termination character, the Read function will wait until it has recieved the termination character and then return immediately. You really do not need Bytes at Port in this situation at all.

If you wish to read a few bytes at a time and search for the termination character with your own VI, then disable the termination character in VISA, use Bytes at Port to tell Read how many characters are available, and append the received data to a string which is passed around the loop by a shift register.

Use one method or the other, but not both at the same time.

Lynn
Message 5 of 11
(3,559 Views)
Thank you very much, Dennis and Lynn!
0 Kudos
Message 6 of 11
(3,553 Views)

I'm so boring...

Do you know some link that explains about serial settings, in VISA property node? I'm trying to understand some attributes.

I modified my VI. It works better!!

 

Vicen

WinXP / LV7.1

0 Kudos
Message 7 of 11
(3,537 Views)
Turn on context help and as you move your mouse over a property or scroll through the available properties, information will be displayed in the help window. If you have  a specific question about one or more of the settings, please ask it.
0 Kudos
Message 8 of 11
(3,533 Views)
ASRL End Out - "Serial End Mode for Writes - This attribute specifies the method used to terminate write operations..."
 
It means that the Termination Character, that I've choosed previously (LF+CR), will add to message and when the message arrives to VISA Read this function searchs this TermChar?
 
Vicens
 
<sorry for my english...>
0 Kudos
Message 9 of 11
(3,523 Views)
If you pass the value End Add TermChar (2) to this property, then your termination character is automatically appended to each VISA Write. So, instead of including a \r\n (for example) in a string control\constant at the end of each command, you can set this property node.
Message 10 of 11
(3,518 Views)