LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Open VISA Session

Hi to all,

I'm newbie with Labview 8.5, I'm viewing some example to connect serial port with VISA blocks. I see that these examples use a VISA Resource Name control to define the resource (example selecting COM1) but after they don't use Visa Open block to open a VISA session with the device, but they use directly the sequence "VISA write - VISA read - VISA Close" blocks. Why don't they use VISA open session to open a session with device?

I read in help that VISA Resource Name contains some informations on resource and it maintains VISA session also, instead VISA session is a unique identifier, I think that when I create new Visa Resource name Control, Labview automatically open a session with this resource, so it isn't necessary to use VISA Open block to create the session, isn't it?

best regards
0 Kudos
Message 1 of 13
(5,229 Views)
Visa resource control opens a reference for the port so doing the same thing as open reference.Also in data communication----> protocol---->serial----> "configure serial port"  first.u can set baud reate data bits etc using this vi alone.



0 Kudos
Message 2 of 13
(5,223 Views)
first try getting the data transfer using hyperterminal. getting the expected output there will solve most of your problem
0 Kudos
Message 3 of 13
(5,221 Views)
Hi!
   You can find here some hints for using VISA functions (I hope it is still valid!), usually the steps are:

    - configure and open serial port
    - perform read/write
    - close

   but it works also if you directly use a VISA write, the session is handled automatically, but this is no recommended procedure!  Is better to gain complete control.

   Hope this helps!

graziano


Message Edited by Graziano on 07-10-2008 06:45 AM
0 Kudos
Message 4 of 13
(5,214 Views)
It's not correct to say that just dropping a resource control itself on the front panel or diagram opens a session. The resource is automatically opened when calling VISA function (i.e. a write or a read), if the resource was not explicitly opened with the VISA Open function. You can see this yourself. Put just a resource control on the block diagram, select the resource and run the VI. Click the arrow on the control and look at the resources. Now, wire a VISA Write to the control, run the VI, and look at the resources. You will now see a little icon next to the resource you selected. This indicates that the resource is open. The automatic opening of a resource was a change made to VISA several years ago and you will still see the VISA Open in instrument drivers. It's not a bad idea to always use the VISA Open function. For serial, you would put it before the VISA Configure Serial Port.
0 Kudos
Message 5 of 13
(5,210 Views)
OK, thanks all.

I have another question: is it wrong to use first Serial Setting block and after use VISA Open block? this would be necessary in my VI!
0 Kudos
Message 6 of 13
(5,173 Views)

Not wrong but redundant. The session is opened by the VISA Configure Serial Port so the VISA Open would do nothing. I also don't see why it would be necessary to put it after.

0 Kudos
Message 7 of 13
(5,169 Views)
I'm trying use lock system to communicate with serial port using two session:
I have two sequence "Open - Read - Close" and I wish that they access to serial port in mutual exclusive mode.
I set each VISA Open block with Duplicate_session= True and access_mode=exclusive_lock, I create a resource name constant and configure it with a Serial Setting block.
The output of Serial Setting block is the input for two VISA Open block.
But in this experiment I note that if the Close block of first sequence is executed, all sessions are closed and other sequences can't read from serial bus because the session of second sequence is closed by Close block of first sequence.
In this case my questions are: Can using Serial Setting block before the two VISA Open blocks generate any problem in this case? Does Close block close only session of resource name that use as input or close also other duplicate sessions?


0 Kudos
Message 8 of 13
(5,156 Views)
As far as I can tell, when you select exclusive lock, only one VISA session is created and it does not matter whether you have duplicate session true or not. I don't think I have ever used the exclusive lock function of the VISA Open function. When I wanted to do a lock, I used the VISA Lock function. I also try to use the VISA Open and VISA close only once in my top level program.
0 Kudos
Message 9 of 13
(5,149 Views)
Hi,

I'm learning VISA Lock async e VISA unlock. I set VISA lock async block with exclusive lock (I think that this is a way to access in exclusive mode in serial device) and timeout = 5000ms. I make an example with 2 segments that try access at same serial device. First segment executes read operation on serial device, it locks VISA Resource name of device and it waits for some time before to perform unlock operation. While first segment is lock on device, the second segment performs operation on same device, it tries access on VISA lock async block, but it doesn't wait on VISA lock async blok but it run serial operations and it performs unlock operation before of first segment, and both segments have VISA code 1073676442 ( (Hex 0x3FFF009A) Operation completed successfully, and this session has nested exclusive locks.). Labview help saids second segment must wait for timeout time and doesn't perform any serial operations, why it doesn't happen?

regards

0 Kudos
Message 10 of 13
(5,084 Views)