Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

RS232 to USB writes in NI max but does not read

Hi,

 

I want to connect SR830 lock in amplifier with my computer to read output values from it. While connecting lock-in using RS232 to USB in NI Max, write command executes without any error but while giving read command, it gives timeout error before operation is completed. 

 

Similarly, in my labview program read command doesn't work  and therefore, the program completes while giving only 0 output all the time. 

 

I have tried changing the RS232 to USB cables and even tried in different computers.

 

It will be really helpful if someone can help.

 

Thanks,

Urvashi

0 Kudos
Message 1 of 9
(266 Views)

You are experiencing one of the following problems..

 

1) Your RS232 to USB isn't properly installed and configured.

2) Your not sending the right termination characters in your code.

3) You aren't sending commands the SR830 understands.

 

But you don't provide enough information for anyone to help you.  You should attach code, show screen shots of NI-MAX, attach/copy error messages, etc.  

 

To rule out #1 & #3, can you prove that the SR830 is responding to your commands?  If you send a command does the front panel change?  Do you check the error status after write?  

 

Best guess is #2.  What termination chars are you sending?  Are you using NI MAX to debug?  What does it show?


Craig

0 Kudos
Message 2 of 9
(212 Views)

Hi Craig,

 

Thanks for your reply and apologies for not sharing the vi and screenshots.

 

Please find attached the screenshots and vi below. I have attached the screenshot of NI MAX where write command works properly without showing any error but read command shows error. Also, I was able to change the frequency of lock in amplifier by the write command. Two VI's are also attached below -one for the write and other for lock in to read. VI corresponding to write doesn't show any error. However, the VI test_sr830_rs232 shows error in VISA read.

 

To answer this:

To rule out #1 & #3, can you prove that the SR830 is responding to your commands?  If you send a command does the front panel change?  Do you check the error status after write?  

I think SR830 does respond as I can change frequency by giving the command.

 

Best guess is #2.  What termination chars are you sending?  Are you using NI MAX to debug?  What does it show?

As I am connecting lock in by RS232, I use carriage return as termination character \r. I am using same termination character in NI Max as well. It shows error in read.

 

Is it possible that due to some installation issue, LOCKIN can write but not read?

 

Thanks,

Urvashi

 

 

0 Kudos
Message 3 of 9
(196 Views)

Just looking at some code now and remember, the SR830 has both RS232 and GPIB support.  It can receive commands over both at the same time BUT you need to specify which one to send your output to.  You need to use the command OUTX {0,1} where 0=RS232 and 1=GPIB.  Have you done this?

 

The LabVIEW driver here uses GPIB (OUTX1) - http://sine.ni.com/apps/utf8/niid_web_display.model_page?p_model_id=1536

 

Try that first, then try experimenting with termination characters.

 

Craig

0 Kudos
Message 4 of 9
(175 Views)

Hi Craig,

 

I have tried giving the OUTX 0 command as well but still getting the same error in read. Also, NI MAX gives the same error while reading any command.

 

Thanks,

Urvashi 

0 Kudos
Message 5 of 9
(159 Views)

Does your cable work with other instruments?  Can you test your SR830 with GPIB?

0 Kudos
Message 6 of 9
(152 Views)

Hi,

 

I have tried communicating through GPIB. It worked fine before but suddenly the communication stopped and it can neither write or read. That's why, I tried communicating through RS232 to USB cable. 

My cable has two components, USB to RS 232 (9 pins) and then 9 pins to 25 pins adapter. The 9 pin to USB works fine with other instrument as well. I have no other component to check the cable RS232 (25 pins) to USB. 

 

Thanks,

Urvashi

0 Kudos
Message 7 of 9
(127 Views)

Now that would have been good info to rdisclose from the start! 

 

If GPIB died and RS232 doesn't work properly either, then it sounds like your instrument is in  of repair. 

0 Kudos
Message 8 of 9
(116 Views)

Hi,

 

Yes, may be that is the problem. I was just wondering if it was the cable or drivers. 

I would better talk to the stanford research systems.

 

Thank you so much for your inputs.

 

Thanks,

Urvashi

0 Kudos
Message 9 of 9
(106 Views)