VB.NET
Dim Ret, Cmd(31) As Integer
Dim talker, stbyte, Cnt As Integer
Dim Pstb(31) As Integer ' Status-byte array
Dim Psrq(31) As Integer ' Status of SRQ array
Cmd(0) = 2 ' Number of other device
Cmd(1) = 3 ' Address of device
Cmd(2) = 4 ' Address of device
Ret = GpPollEx(Cmd, Pstb, Psrq)
For Cnt = 1 to Cmd(0)
If (Cnt > Psrq(0)) Then
Exit For
End If
If (Psrq(Cnt) == 1) Then ' When SRQ is sent
talker = Cmd(Cnt) ' Address of SRQ returned device
stbyte = Pstb(Cnt) ' Status-byte of SRQ returned device
End If
Next
C
DWORD Ret, Cmd[31];
DWORD talker, stbyte, Cnt;
DWORD Pstb[31]; /* Status-byte array */
DWORD Psrq[31]; /* Status of SRQ array */
Cmd[0] = 2; /* Number of other device */
Cmd[1] = 3; /* Address of device */
Cmd[2] = 4; /* Address of device */
Ret = GpPollEx(Cmd, Pstb, Psrq);
for (Cnt = 1; Cnt <= Cmd[0]; Cnt++) {
if (Cnt > Psrq[0]) {
break;
}
if (Psrq[Cnt] == 1) { /* When SRQ is sent */
talker = Cmd[Cnt]; /* Address of SRQ returned device */
stbyte = Pstb[Cnt]; /* Status-byte of SRQ returned device */
}
}
C#
uint Ret;
uint talker, stbyte, Cnt;
uint[] Cmd = new uint[31];
uint[] Pstb = new uint[31]; /* Status-byte array */
uint[] Psrq = new uint[31]; /* Status of SRQ array */
Cmd[0] = 2; /* Number of other device */
Cmd[1] = 3; /* Address of device */
Cmd[2] = 4; /* Address of device */
Ret = gpib.PollEx(Cmd, Pstb, Psrq);
for (Cnt = 1; Cnt <= Cmd[0]; Cnt++) {
if (Cnt > Psrq[0]) {
break;
}
if (Psrq[Cnt] == 1) { /* When SRQ is sent */
talker = Cmd[Cnt]; /* Address of SRQ returned device */
stbyte = Pstb[Cnt]; /* Status-byte of SRQ returned device */
}
}
Python
Ret, Cmd = ctypes.c_ulong(), (ctypes.c_ulong * 31)()
talker, stbyte, Cnt = ctypes.c_ulong(), ctypes.c_ulong(), ctypes.c_ulong()
Pstb = (ctypes.c_ulong * 31)() # Status-byte array
Psrq = (ctypes.c_ulong * 31)() # Status of SRQ array
Cmd[0] = 2 # Number of other device
Cmd[1] = 3 # Address of device
Cmd[2] = 4 # Address of device
Ret.value = GpibPy.GpPollEx(Cmd, Pstb, Psrq)
for Cnt in rang(1, Cmd[0]+1):
if Cnt > Psrq[0]:
break
If Psrq[Cnt] == 1: # When SRQ is sent
talker.value = Cmd[Cnt] # Address of SRQ returned device
stbyte.value = Pstb[Cnt] # Status-byte of SRQ returned device