Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

GPIB messages conflicting

I have a single GPIB board connected to two pieces of equipment.  The equipment has different GPIB address (3 and 4) and I am using VISA to address (VISA write vi and VISA read vi) them with the VISA references "GPIB0::3::INSTR" and "GPIB0::4::INSTR".  I was experiencing a problem with getting garbage back from one of the pieces of equipment and I used NI-spy to track down that there seems to be interference between messages to the different addresses.  This a good example:

 

28357.  viWrite (0x00211168, "TEC:T?", 6, 6)
Process ID: 0x00000E04         Thread ID: 0x00000350
Start Time: 11:22:02.093       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)

28358.  viWrite (0x002104D0, "LAS:COND?", 9, 9)
Process ID: 0x00000E04         Thread ID: 0x00000350
Start Time: 11:22:02.093       Call Duration 00:00:00.016
Status: 0 (VI_SUCCESS)
28359.  viRead (0x00211168, "36.7778", 255, 7)
Process ID: 0x00000E04         Thread ID: 0x00000350
Start Time: 11:22:02.109       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)
28360.  viRead (0x002104D0, "64.", 20, 3)
Process ID: 0x00000E04         Thread ID: 0x00000350
Start Time: 11:22:02.109       Call Duration 00:00:00.016
Status: 0 (VI_SUCCESS)

The writes and reads are shuffled together and the read to the first write doesn't  return 36.7778 to the VI doing the calling as expected.

 

I had though that the GPIB took care of separating all the messages by address, but this doesn't appear to be the case.  Can anyone shed any light on why this is happening.  A simple (though time consuming) fix would be to use semaphores to "lock" the GPIB card until the write-read combination is complete, but I would have thought that this was unnecessary.

 

Thanks for any help,

 

Damian

0 Kudos
Message 1 of 2
(3,037 Views)
I'm no expert on NI-Spy but I don't see anything unusual. There is nothing to prevent a command being sent to instrument A and then a command to instrument B before a read is done on instrument A. If your code is in parallel, one would assume that is what you wanted to do. Parallel operations not something you can really do though in most cases and I would recomend you use dataflow to control execution order.
0 Kudos
Message 2 of 2
(3,011 Views)