ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Using NI 488.2 Receive routine returns a empty string

Hi All
Why do I get a empty string when I am stepping through the code using the "Receive" routine (NI 488.2).
But I do get a return string if I do not step through the code.
BTW I am using visual basic version 6 / Windows XP OS.

Sample code:
    Dim idnStr        As String * 20
    Dim iBoardID   As Integer
    Dim iDUTAddr  As Integer

    iBoardID = 0
    iDUTAddr = 5

    'Write *IDN? to the instrument
    Call Send(iBoardID, iDUTAddr, "*IDN?", DABend)
   
    'Read String from instrument
    Call Receive(iBoardID, iDUTAddr, idnStr, DABend)


0 Kudos
Message 1 of 3
(3,550 Views)

Hi,

Maybe you are receiving a timeout error but because you are not receiving the return value you maybe missing it.

The default timeout is 10 secs.

Regards

Ray Farmer

Regards
Ray Farmer
0 Kudos
Message 2 of 3
(3,541 Views)

Hi,

In your Receive statement, it is currently setup like so:

Call Receive(iBoardID, iDUTAddr, idnStr, DABend)

where it is using the termination of DABend. However, the DABend termination is for the Send call. For terminating the Receive call, try using STOPend instead, as shown below:

Call Receive(iBoardID, iDUTAddr, idnStr, STOPend)

According to the online help for Receive, the Termination STOPend stops the read when a byte is received with the EOI line asserted.

Hope this information helps!

gpibtester

Message 3 of 3
(3,527 Views)