Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

I Multiple VIs using the same GPIB controller.

I have multiple VIs running concurrently which access the same GPIB controller, GPIB0, to communicate with their device on the GPIB buss.  All the devices have different subaddresses.  Each VI controls a different device on the GPIB buss.  How do I assure that when the GPIB controller receives an SRQ from some device that it will direct the SRQ to the VI which controls the device with the subaddress contained in the SRQ?

 

Regards,

Dave

0 Kudos
Message 1 of 2
(2,992 Views)

Hey Tri_State_Port,

 

There are multiple ways of implementing this. The easiest way would probably be to have a main VI that waits for the SRQ line to be asserted, polls the GPIB devices to figure out who requested service, then call the subVI for that device.

 

The WaitSRQ.vi function found in the GPIB palette in LabVIEW waits until the SRQ line is set before returning. Once your program moves past this function, you will know that something is requesting service, and will need to determine which device set the SRQ. The FindRQS.vi function also found in the GPIB palette performs a serial poll across the bus and devices you specify to figure out which instrument's RQS bit has been set high, and returns an index to that instrument. From here, you can pass this index into a case structure, and call the subVI associated with that particular instrument. 

 

The relationship between the RQS bit and the SRQ line must be understood to see why this will work. If the status word of a GPIB instrument is updated to set the RQS bit, then the instrument will assert the SRQ line on the GPIB bus. So, by polling each device to see if it's RQS bit is set, you can determine who is requesting service on your GPIB bus. More information on the differences between SRQ and RQS can be found in this KnowledgeBase article : KnowledgeBase 3DTHGIRY : Difference Between SRQ and RQS

Justin E
National Instruments R&D
0 Kudos
Message 2 of 2
(2,972 Views)