LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

RS232 Problem

I would like to control an rs232 instrument with my labview 5.1.
I have written a Vi using VISA driver but it doesn't work.
If i use hyperterminal my instrument answers, but not when i try to send
same command with lab.
I think that i don't understand how to use terminarion char. In a property
node I set TermChar (on), TermChar (A), EndOut (TermChar). Each command is
an ASCII string and must be terminated by a carriage Return char (property
node setting is correct?).
In Write buffer control I have not set '\'Codes display (what is that?).
I am not expert in Labview... can someone help me?
0 Kudos
Message 1 of 5
(3,386 Views)
Could you post an example of your code? You need to configure the serial port with Visa Configure Serial, write the command with proper termination, wait, read instrument response, close Visa session. Setting '\' Codes will cause carriage return and line feeds to be displayed as \r and \n, otherwise these are not displayed in the text box. You can set termination character in the configure serial port vi, you don't have to use property nodes at all. Also termination character applies to reading the serial stream from the instrument. The character tells the Visa Read when the received string is ended. When this character is seen, the Read is over and the string is returned, even though there may be more characters at the serial port. They will get read next
time Read is called.
- tbob

Inventor of the WORM Global
0 Kudos
Message 2 of 5
(3,386 Views)
Actually, the VISA Configure Serial Port does use a VISA property node and, in newer versions of VISA anyway, you can also set the Write termination character.
0 Kudos
Message 3 of 5
(3,386 Views)
Hello,

If it works in HyperTerminal, then what I think is happening is exactly the termination character thing. Go to the �\Code display� mode. That will let you see the representation of non-printing characters as the null, tab, space, etc.
In this case you should type the command you want to write with the termination characters at the end. Something as *IDN?\n
Some instruments use \n, other \r, and other \n\r. So it would be a good idea to try them all.
When you read back of the instrument, you need to specify the number of bytes to read, what you can do right now just to make sure that you are reading something is to read just one byte.
If it doesn�t work, check the version of visa that you have and try upgrading.
Try to run in MAX the same thin
g by opening a VISA session and writing and reading with those termination characters.
Hope this helps
0 Kudos
Message 4 of 5
(3,386 Views)
Thanks.. Your suggestions have been very effective!!

Now my VI seems to be Ok!!!



Ricardo SR wrote:
> Hello,
>
> If it works in HyperTerminal, then what I think is happening is
> exactly the termination character thing. Go to the "\Code display"
> mode. That will let you see the representation of non-printing
> characters as the null, tab, space, etc.
> In this case you should type the command you want to write with the
> termination characters at the end. Something as *IDN?\n
> Some instruments use \n, other \r, and other \n\r. So it would be a
> good idea to try them all.
> When you read back of the instrument, you need to specify the number
> of bytes to read, what you can do right now just to make sure that you
> are reading something is to read jus
t one byte.
> If it doesn't work, check the version of visa that you have and try
> upgrading.
> Try to run in MAX the same thing by opening a VISA session and writing
> and reading with those termination characters.
> Hope this helps
0 Kudos
Message 5 of 5
(3,386 Views)