Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

SR400 serial RS232

Dear All,

 

I want to readout the Stanford Research counter SR400 via its serial port RS232. Please note, readout via the GBIP interface, for which I found some examples, is not an option.

 

The serial readout was tested with Hyperterminal and a self-written Matlab script. Both work flawless. Hence I assume the settings and teh port are ok.

 

I use Labview v.8.6. Start point is the 'Basic Serial Write and Read.vi' from the Labview examples with the RS232 settings from the matlab script.

 

The encountered problem is that when a command string is sent to the SR400, the Labview VI puts by itself a 'space' string in front of the command string. This can be seen on the display of the SR400. The modified command string can not be interpreted by the SR400. I checked that the sent command string is correctly 8bit long.

 

This additional 'space' can also be seen in the echo of the SR400 shown read pane of the Labview VI (see attached screenshot). The '??>' string indicates that the sent command contains an error. Instead of 8 bit the echo has 9 bit. This is probably the dot in front of the '??>' string, which should be there either.

 

What is going wrong? Is that a problem with the frame of the command? What kind of adjustments have to be done to the VI? Any hints or example VI are very welcome!

 

Many thanks in advance!
Rolf 

0 Kudos
Message 1 of 11
(4,262 Views)
You should attach your VI. The front panel image tells nothing about your code.
0 Kudos
Message 2 of 11
(4,253 Views)

Hi,

 

As mentioned I used the NI provided example for serial communication. Please find this vi attached.

 

Rolf

0 Kudos
Message 3 of 11
(4,250 Views)

Don't send a shipping example. As shown in your image, you have a VI called Counter_SR400.

 

Your comment about the command being 8 bits does not make any sense. In your image, you are sending 3 bytes (if the \r is sent correctly).

0 Kudos
Message 4 of 11
(4,245 Views)

Ok, here you go.

 

This VI runs with the same result. It shows additionally the number of bytes written to the RS232.

 

You are right, I was wrong with the 8bit (used a property node to read out the wrong property). The string received by the SR400 is always "<space>SS[cr]", i.e.. " SS[cr]" (as displayed by the SR400), where it should be "SS[cr]".

 

The string in the read pane of the VI is the echo of the SR400. The string "??>" is the SR400's prompt that the sent command was not correct. The dot in the string comes also from the VI. In case of a working communication and an incorrect command, the echo should read "SS??>" correctly. In case of a working communication and a correct command the prompt reads "SSOK>"


Rolf

Download All
0 Kudos
Message 5 of 11
(4,241 Views)

Have you tried terminating with LF or CR/LF?

0 Kudos
Message 6 of 11
(4,232 Views)

Yes, tried all combinations. However teh SR400 request a \r.

 

Rolf

0 Kudos
Message 7 of 11
(4,230 Views)

you can use the NI Spy Tool for further debugging:

 

http://digital.ni.com/public.nsf/allkb/282C5D41E2BA04F2862574BA007803B9?OpenDocument

 

Cheers,

Cheggers

Sascha
0 Kudos
Message 8 of 11
(4,203 Views)

50 'SET THE COM MENU OF THE SR400 FOR RS-232 BAUD=9600
60 ' RS-232 BITS=8
70 ' RS-232 PARITY=NONE
80 ' RS-232 WAIT=6
90 ' RS-232 ECHO=OFF

100 '
110 '
120 OPEN "COM1:9600,N,8,2,CS,DS,CD" AS #1

 

from the manual example pg 50

 

You example uses 19.2K, Even,8,  1, None  you need 9600, None, 8, 2 none

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 9 of 11
(4,130 Views)

The SR400 is configurable. Its maximum baudrate is 19200 (according to the manual). I tried different settings with no success.

 

Anyway the settings I used for teh VI are settings working perfectly with other software. The SR400 reads the command sent by the VI . It could be a timing issue.

 

Rolf

0 Kudos
Message 10 of 11
(4,126 Views)