13
The following are examples of programs which communicate with the SR640 in a variety of
languages over both RS232 and GPIB. In each case, the program does the same thing: Set the
channel 1 pregain to 10 db, the Channel 2 postgain to 20 db, and read the value of the channel
1 cutoff frequency. Once the basics of writing to and reading from the SR640 are mastered,
the task of programming is reduced to simply finding the appropriate command from the
command list.
Pr ogr am Exampl e 1
I BM PC, BASI C, vi a RS232
In this example, the IBM PC's COM2: serial port is used to communicate with the SR640. Note
that a "straight through" RS232 cable (NOT a null modem cable) should be used to connect the
PC to the SR640. The SR640 should be set to operate at 9600 baud, 8 bits, no parity.
10'Example program for the SR640 filter using IBM BASIC over the COM2: port
20'
30'Open the COM2: port for 9600, 8 bits, no parity, ignore handshake
40 OPEN "COM2:9600,N,8,2,CS,DS,CD" AS #1
50'
60' Clear COM2 port
70 PRINT #1," "
80' Set channel 1 pregain and postgain
90 PRINT #1,"PREG1,1;PSTG2,2"
100 'Now read channel 1 cutoff frequency
110 PRINT #1, "FREQ?1"
120 INPUT #1, FREQ
'read answer
130 PRINT "frequency = ",FREQ
140 STOP
Pr ogr am Exampl e 2
I BM PC, Mi cr osof t FORTRAN, Nati onal I nstr uments GPI B Car d
Please refer to the "Guide to Programming" section for additional information on using the
National Instruments GPIB card. The GPIB.COM driver must be configured with IBCONF before
using the National Instruments cards.
c example program for the SR620 using Microsoft FORTRAN and National Instruments GPIB
card
c compile with /FPa /AL and link with MFIBL.OBJ (supplied by National Instruments)
$storage:2
c this line must be in the source file
common /ibglob/ibsta,iberr,ibcnt
integer sr640
PR OG RAMMING EXAMPLES
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com
Summary of Contents for SR640 Series
Page 4: ...2 Artisan Technology Group Quality Instrumentation Guaranteed 888 88 SOURCE www artisantg com...
Page 6: ...4 Artisan Technology Group Quality Instrumentation Guaranteed 888 88 SOURCE www artisantg com...
Page 8: ...6 Artisan Technology Group Quality Instrumentation Guaranteed 888 88 SOURCE www artisantg com...