Multiple port synchronization, Synchronized waveforms program, Tion…… 30 – Measurement Computing DAC488 v.1 User Manual
Page 36: Forms program…… 30
30 DAC488 Operation
DAC488 User’s Manual
Multiple Port Synchronization
Multiple DAC port output changes may be synchronized in any of the triggered modes of operation
(Indirect, Stepped and Waveform). This is done by using the trigger mask commands to enable the ports to
trigger on the same trigger event(s).
Synchronization in Waveform mode is automatically accomplished by programming multiple ports with the
same time interval using the Interval (
I
) command and the same buffer size using the Buffer Definition (
F
)
command. The BASIC program
DAC4WAVE.BAS
included on the program disk shows how multiple,
synchronized waveforms may be generated. This program is included below.
Synchronized Waveforms Program
The following BASIC program
DAC4WAVE.BAS
is used with the DAC488 to generate a waveform at a user
selectable frequency and 20 volts peak-to-peak centered at 0 volts:
10 REM Basic program to load the DAC488/4 buffer w multiple waveforms
20 REM Initialize the IOtech IEEE488 Driver
30 CLS : KEY OFF
40 OPEN "\dev\ieeeout" FOR OUTPUT AS #1
50 IOCTL #1, "BREAK"
60 PRINT #1, "RESET"
70 OPEN "\dev\ieeein" FOR INPUT AS #2
80 PRINT "DAC488 Waveform Demonstration Program"
90 PRINT
100 PRINT"Set address of DAC488 to 09 and connect to controller"
110 PRINT
120 PRINT"Hit any key to start"
130 IF INKEY$="" THEN GOTO 130
140 PRINT:PRINT #1, "CLEAR 09"
150 PRINT #1, "output 09;P3XE?" 'Determine if DAC488/4 or DAC488/2
160 PRINT #1, "ENTER 09"
170 INPUT#2,A$
180 IF A$ = "E0" THEN DAC2$ = "N" ELSE DAC2$ = "Y"
190 IF DAC2$ = "Y" THEN MODEL$ = "2" ELSE MODEL$ = "4"
200 PRINT "Initializing the DAC488/";MODEL$;" this will take a while"
210 REM First a 256 point sinewave
220 PRINT #1, "output 09;c3l0x"
230 POINTS = 256: REM number of points in the sine wave
240 PI = 3.1415926535#
250 INC = (2! * PI) / POINTS
260 FOR LOOP = 1 TO POINTS
270 PVAL = 4095*SIN(LOOP * INC)
280 PRINT #1, "output 09;b3,#";CINT(PVAL);"x":NEXT
290 REM Now a triangle wave
300 INC = 4096 / 64
310 FOR LOOP = 0 TO 4095 STEP INC
320 PRINT #1,"output 09;b3,#";LOOP;"x":NEXT
330 FOR LOOP = 4095 TO -4095 STEP -INC
340 PRINT #1,"output 09;b3,#";LOOP;"x":NEXT
350 FOR LOOP = -4095 TO 0 STEP INC
360 PRINT #1,"output 09;b3,#";LOOP;"x":NEXT
370 REM Now a square wave
380 PRINT #1,"output 09;b3,#4095xb3,#-4095x"
390 REM Main Loop
400 CLS