AN501

 

Product: Domino 1 and 2

 

Adding an External DAC

Date: 3/6/98

Introduction: This application note shows how to interface a 12-bit serial digital to analog converter to the Domino 1 and 2.
 

Background: Even though the Domino modules offer a wide range of features, sometimes you need a little something extra like a DAC output. Connecting a serial device such as the Linear Technologies LTC1257 DAC can be accomplished easily with a few lines of BASIC code and three bits of Port 1.

How it works: The sample program asks the user for the desired output voltage of the LTC1257’s output pin and outputs the desired voltage. If additional outputs are needed, the clock and data lines may be shared between devices and additional Port 1 pins used to select the individual chips.
 

Program Listing:

10 REM Domino - LTC1257 DAC Program
20 REM *LD = Port1.4, CLK = Port1.5, DIN = Port1.6
30 LD = 10h : CK = 20h : DA = 40h
40 PORT1 = PORT1 .OR. LD : REM raise *LD
50 PORT1 = PORT1 .AND. (0FFh-CK) : REM drop CLK
60 PORT1 = PORT1 .AND. (0FFh-DA) : REM drop DIN
70 INPUT "Enter desired output voltage: ",V
80 V = V/(5/4095)
90 FOR X = 11 TO 0 STEP -1
95 REM TEST VALUE, IF BIT=1 THEN CLOCK A 1, ELSE CLOCK A 0
100 IF (V.AND.2**X)<>0 THEN GOSUB 2000 ELSE GOSUB 1000
110 NEXT X
120 GOSUB 3000
130 PRINT
140 GOTO 70

1000 PORT1 = PORT1 .AND. (0FFh-CK) : REM drop CLK
1010 PORT1 = PORT1 .AND. (0FFh-DA) : REM drop Din
1020 PORT1 = PORT1 .OR. CK : REM raise CLK
1030 RETURN
2000 PORT1 = PORT1 .AND. (0FFh-CK) : REM drop CLK
2010 PORT1 = PORT1 .OR. DA : REM raise Din
2020 PORT1 = PORT1 .OR. CK : REM raise CLK
2030 RETURN
3000 PORT1 = PORT1 .AND. (0FFh-LD) : REM drop *LD
3010 PORT1 = PORT1 .OR. LD : REM raise *LD
3020 RETURN

 

 



Copyright © 2002, Micromint Inc.
Last modified 07 Jan 2002 by
webmaster@micromint.com