LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Questions about the serial comm example

Hello,

  I have several questions about the "Basic Serial Write and Read" vi that I have found in the NI examples. Unfortunately I have not been able to paste a screenshot
of the front panel and block diagram in this post to help explain the questions that I have. So if someone can tell me how to paste images into a post that would be cool.
My questions are:

  1. Is VISA the preferred method/driver/etc to use with Labview to talk to com ports?
  2. I looked at the block diagram of the "basic Serial Write and Read" and would like to understand how the com port stays open if both of toggle switches are off, or for that matter even if both are on. The block diagram indicates that after the read operation the com port is closed. Well what "re-opens" the com port to allow multiple com port actions to be performed?
Regards,


Kaspar
0 Kudos
Message 1 of 3
(2,625 Views)

1. VISA is not only the preferred, it is the only supported method fro serial communication. VISA is a common API for serial, GPIB, VXI, PXI, USB, and Ethernet communication.

2. The com port is closed by the VISA Close function you see on the diagram. By doing a VISA Close, you enable other applications (i.e. Hyperterminal) to use the com port. The com port can be opened by using a VISA Open (Instrument I/O>VISA>VISA Advanced palette) function. In older versions of VISA, you had to first call the VISA Open to create the session. In more recent versions, if a VISA session is not already open when you do a VISA operation like a read or write, the session will be automatically created first. It's probably a good idea to still include a VISA Open once at the beginning of your program and a single VISA Close at the end but I must admit that lately I haven't always done the VISA Open, just the VISA Configure Serial Port.

0 Kudos
Message 2 of 3
(2,615 Views)
Hello,

  Thnaks for the quick response and the info about a com session being automatically opened when a read or write operation is requested.
Regards,


Kaspar
0 Kudos
Message 3 of 3
(2,608 Views)