Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

IBRD - expecting a multiline response, serial poll replies command completed, but no data ready

Hello all,

 I have tried searching the forums for similar issues but no luck, So here is my issue

Language = VB6

GPIB interface = USB

Instrument type = NI 7265 lockin amplifier

 

Most of the communication involved is a simple send command (IBWRT) and then serial poll waiting for data ready signal, and this works great, all the commands return single line strings.

I am now trying to use a command to query the firmware revision of the lockin (REV) which the manual states responds with a 4 line reponse, hwoever the serial poll never gets to decimal 128 to show that data is ready, it simply shows a command complete status (decimal 1, which appears to be from the previous command)

 

the code i use is below

 

Public Function LiRead_Data(Call_string)

 

askString = Call_string + Chr(13)                'CR terminated string required

Call ibwrt(devAssign, askString)                   

 

SPSB = 0

  While SPSB = 0                                       ' This just loops if the instrument is busy
        Call ibrsp(devAssign, SPSB)               ' devAssign is previously associated with the lockin
        If SPSB >= 128 Then                          ' data is ready go read it
            b = Space$(32)                              ' in theory this should be ibcnt (which is updated at each serial poll)
            Call ibrd(devAssign, b)                     ' read available data
            LiRead_Data = Left(b, ibcnt)            ' trim data set the function return
        End If
    Wend

 

There is some error trapping code also but none of that gets triggered as SPSB is always 1 (command completed)

 

When i use any of the other lockin functions that return a single line reponse - the process occurs as i expected, there may be a few loops while the SPSB is still zero as the instrument sorts itself out but after a loop or two it returns the expected result. this can be seen on the comms test menu on the instrument

 

however when i send a REV command that the device manual says "returns a 4 line response which the receiving program must be able to accept", the SPSB goes straight to a 1 - never indicating that there is any data there to read. However on the comms menu of the instrument it clearly shows 4 seperate lines of data seperated by <CR><LF> characters.

 

I was expecting to maybe receive the first line if some where in the code it terminated at the first <CR><LF> characters, but as far as i can tell no data ever becomes available.

 

So the question is have i understood the principal of the serial polling sufficiently that what i think should be happening is, or is it somethig i have missed.

I have monitored ibcnt and this shows no data available also.

 

any help would be appreciated.

 

Thanks

 

Justin

 

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

I Should say that the REV command is pretty trivial, but there are other multiline commands that i will need to use in the future, and this one seemed an easier one to start with. I just want to ensure that i have understood the process correctly for using the serial Poll.

 

Thanks

 

0 Kudos
Message 2 of 2
(2,909 Views)