Appendix D: Program Examples - Stanford Research Systems SR510 Manual

Lock-in amplifier
Table of Contents

Advertisement

Appendix D:
Program Examples
All of the program examples which follow do the
same thing, only the computer, language, or
interface is changed. The programs read the
Channel 1 and 2 Outputs and write the results to
the computer screen. In addition, the X6 analog
output port is ramped from 0 to 10V.
Program Example 1:
IBM PC, Basic, via RS232
In this example, the IBM PC's ASYNC port (known
as COM1: or AUX: to DOS users) will be used to
communicate with the SR510. Only two wires
between the IBM PC's ASYNC port and the
SR510 are needed (pins #2 & #3 of the RS232),
but pins 5,6,8 and 20 should be connected
together on the connector at the IBM end.
10 '
EXAMPLE PROGRAM TO READ THE SR510 OUTPUT AND RAMP THE X6 ANALOG OUTPUT
20 '
USING IBM PC BASICA AND THE COM1: RS232 PORT.
30 '
40 '
50 '
ON THE REAR PANEL OF THE SR510, SET SWITCH #1 OF SW2 DOWN
60 '
AND ALL OTHER SWITCHES IN SW2 UP. (9600 BAUD, NO PARITY)
70 '
80 OPEN "COM1:9600,N,8,2,CS,DS,CD" AS #1
90 '
SET UP COM1: PORT TO 9600 BAUD, NO PARITY, 8 DATA BITS, 2 STOP BITS,
100 '
110 '
120 '
130 PRINT #1, "
140 PRINT #1,"Z"
150 FOR I = 1 TO 200: NEXT I
160 '
170 X = 0
180 '
190 PRINT #1, "Q" 'READ OUTPUT
200 INPUT #1,V1
210 '
220 PRINT "OUTPUT = ";V1
230 '
240 X =X + .0025
250 IF X > 10 THEN X = 0
260 PRINT #1, USING "X6, ##.###";X
270 '
280 GOTO 190
IGNORE CTS (CLEAR TO SEND), DSR (DATA SET READY),
AND CD (CARRIER DETECT).
"
'CLEAR UART BY SENDING SPACES
'RESET SR510
'WAIT FOR RESET TO FINISH
'INIT X6 OUTPUT TO ZERO
'INTO V1
'INCREMENT X6 OUTPUT BY 2.5 MV
'RESET X6 RAMP
'LOOP FOREVER
'SET X6 OUTPUT VOLTAGE
42

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents