Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

RS232 Control of SR830 Lock in: write and read problem

Hi friends,

 

I am working on using RS232 interface to control SR830 lock in amplifier. One problem I have so far is that there seems a mismatch between instrument response time and labview response time. Specifically, when the visa read and write functions are called in a normal mode, the vi cannot read anything from the read buffer. However, when the highlight mode is on (the one mode you have to click the light bulb button), the vi starts being able to read values from the read buffer. I wonder whether someone here knows what's going on in my case and even how to fix this one. I've attached the snippets of my labview code for future reference. 

0 Kudos
Message 1 of 2
(565 Views)

Hi

In your other post on the same subject you was asked to add a CR or LF and you did in this example.

The only big mistake is that you used Bytes Available.

NEVER use bytes available unless no other option is available or if you have a specific well tested working system.

 

The race condition you get is that you asked much too early how many bytes are available.

The solution is to issue a read operation with end character enabled for more characters than you expect.

In your case ask for e.g. 100 characters.

The only thing you need to specify in open serial visa is the correct end character like 10 for LF and 13 for CR.

greetings from the Netherlands
0 Kudos
Message 2 of 2
(546 Views)