Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Failed communication using SR830 RS232 interface

Hi friends, 

 

I was trying to connect SR830 to Labview using RS232 interface, but thus far there is no joy. What I was trying to do is to extract the output values from both of the channels. However, when I typed the OUTP? 1 command, the reading buffer is always empty. I've attached my code as snippets below, and any related pointers will be appreciated. 

0 Kudos
Message 1 of 4
(1,319 Views)

I'm guessing your issue is you are not sending the line feed or carriage return at the end of your command.  I prefer to put that on the block diagram so the user doesn't have to worry about it.  Use a Concatenate String and a Line Feed Constant to append the Line Feed to the end of your write buffer before the VISA Write.

 

Alternatively, you could try the driver for this device here: Stanford Research 830 Amplifier VISA Driver 


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 4
(1,286 Views)

Hi Crossrulz,

 

Thanks for the reply. I've tried the way you suggested, but there is no read buffer coming out. I wonder whether you can lend more pointers about this accordingly. As for the GPIB, in terms of the cost, currently we cannot afford it. Looking forward to hearing from you.

0 Kudos
Message 3 of 4
(1,270 Views)

A few things that needed correcting here.

1. You only need to send the OUTX command once at the start of the application.  So move that outside of the loop.  Further, the command needs a space between the command and the parameter.

2. You are only looking at the latest string that was read.  Since this loop will go super fast (no waits or waiting for data to come in), you are not likely to see any response coming in.  Instead, change the data in the shift register to be a simple string and use Concatenate String to build a string that you display.  This will allow you to see all data that has been read.

3. You really should have something to tell you if there was an error.  My suggestion for this simple example is to stop the loop if there is an error and make sure the error is displayed at the end.

 

This setup is fine for a quick example, but it will not scale well at all.  If you insist on doing your own thing here instead of using the drivers I linked to before, make sure you watch this video: VIWeek 2020/Proper way to communicate over serial


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Download All
0 Kudos
Message 4 of 4
(1,245 Views)