Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

A strange error when using VISA READ STB function to query status byte.

When I use this function to query the status byte of Standford Research SR830 Lock-in Amplifier,I encounter a strange error.After the function,I use VISA WRITE to query *IDN?.The byte wrriten is 1,not 5 and the read result is wrong.The complete ID is "Stanford_Research_Systems,SR830,s/n76157,ver1.07",but the intrument only deliver "S" for me.If I run the VI again,the number  turnsback to 5 and the result is right now.Then run again,it turns to 1 again,and then 5 back....But if I use VISA WRITE to send "*STB?",everything is normal.I am quite confused.In addtion,if I use VISA CLEAR function,the error also emerge.
 
Do you ever encounter such problem?
0 Kudos
Message 1 of 3
(3,526 Views)

This is difficult to diagnose without seeing your code, but I would guess that you are telling the function to only receive 1 byte of data from the instrument.  Look at the parameters for the method, one of them may be the number of bytes to read, if you only put a "1", you will only read 1 byte (converted to character, you get one "S" returned, the first character of the ID).

Post the part of your code you are using for further analysis.

 

0 Kudos
Message 2 of 3
(3,408 Views)
My previous post also explains why the "*STB?" query completes as it should.  Whe you read the status byte, you are only reading 1 byte, so if you are requesting 1 byte, it completes without error.
 
 
0 Kudos
Message 3 of 3
(3,406 Views)