AD664
The following IBM PC Basic routine produces four output volt-
age ramps from one AD664. Line numbers 10 through 70 de-
fine the hardware addresses for the first and second ranks of
DAC registers as well as the first and second ranks of the mode
select register. Program variables are initialized in line numbers
110 through 130. Line number 170 writes “0s” out to the first
rank and, then, the second rank of the mode select register.
Line numbers 200 through 320 calculate output voltages. Fi-
nally line numbers 410 through 450 update the first, then the
second ranks of the DAC input registers. Hardware registers
may be read with the “INP” instruction. For example, the con-
tents of the DAC A register may be accessed with the following
com mand: Line# A = INP(DACA).
5
10
REM----AD664 LISSAJOUS PATTERNS----
REM ---ASSIGN HARDWARE ADDRESSES---
20
DACA = 785
30
DACB = 787
40
DACC = 789
50
DACD = 791
60
DAC2ND = 792
70
MODE1 = 769: MODE2 = 776
80
REM
90
REM
100
110
120
130
140
150
160
170
180
190
200
210
220
230
240
250
260
270
280
290
300
310
320
330
340
400
410
420
430
440
450
500
510
520
530
REM ---INITIALIZE VARIABLES---
X = 0: Y1 = 128: Y2 = 64: Y3 = 32
CX = 1: CY1 = 1: CY2 = -1: CY3= 1
FX = 9: FY1 = 5: FY2 = 13: FY3 = 15
REM
REM
REM ---INITIALIZE MODES AND GAINS---
OUT MODE1,0: OUT MODE2,0
REM
REM
REM ---CALCULATE VARIABLES---
X = X + FX*CX
Y1 = Y1 + FY1*CY1
Y2 = Y2 + FY2*CY2
Y3 = Y3 + FY3*CY3
IF X > 255 THEN X = 255: CX = -1: GOTO 270
IF X < 0 THEN X = 0: CX = 1
IF Y1 > 255 THEN Y1 = 255: CY1 = -1: GOTO 290
IF Y1 < 0 THEN Y1 = 0: CY1 = 1
IF Y2 > 255 THEN Y2 = 255: CY2 = -1 GOTO 310
IF Y2 < 0 THEN Y2 = 0: CY2 = -1
IF Y3 > 255 THEN Y3 = 255: CY3 = -1: GOTO 400
IF Y3 < 0 THEN Y3 = 0: CY3 = 1
REM
REM
REM ---SEND DAC DATA---
OUT DACA,X
OUT DACB,Yl
OUT DACC,Y2
OUT DACD,Y3
OUT DAC2ND,0
REM
REM
REM ---LOOP BACK---
GOTO 210
D
REV.
–17–