DatasheetQ Logo
Electronic component search and free download site. Transistors,MosFET ,Diode,Integrated circuits

AD8804AN Ver la hoja de datos (PDF) - Analog Devices

Número de pieza
componentes Descripción
Fabricante
AD8804AN Datasheet PDF : 16 Pages
1 2 3 4 5 6 7 8 9 10 Next Last
AD8802/AD8804
;
; This subroutine loads an AD8802/AD8804 DAC from an 8051 microcomputer,
; using the 8051’s serial port in MODE 0 (Shift Register Mode).
; The DAC value is stored at location DAC_VAL
; The DAC address is stored at location DAC_ADDR
;
; Variable declarations
;
PORT1
DATA
90H
DAC_VALUE
DATA
40H
DAC_ADDR
DATA
41H
SHIFT1
DATA
042H
SHIFT2
DATA
043H
SHIFT_COUNT
DATA
44H
;
ORG
100H
DO_8802:
CLR
SCON.7
CLR
SCON.6
CLR
SCON.5
CLR
SCON.1
ORL
PORT1.1,#00001110B
CLR
PORT1.1
MOV
SHIFT1,DAC_ADDR
ACALL
BYTESWAP
MOV
SBUF,SHIFT2
ADDR_WAIT:
JNB
SCON.1,ADDR_WAIT
CLR
SCON.1
MOV
SHIFT1,DAC_VALUE
ACALL
BYTESWAP
MOV
SBUF,SHIFT2
VALU_WAIT:
JNB
SCON.1,VALU_WAIT
CLR
SCON.1
SETB
PORT1.1
RET
;
BYTESWAP:
MOV
SHIFT_COUNT,#8
SWAP_LOOP:
MOV
A,SHIFT1
RLC
A
MOV
SHIFT1,A
MOV
A,SHIFT2
RRC
A
MOV
SHIFT2,A
DJNZ
SHIFT_COUNT,SWAP_LOOP
RET
END
;SFR register for port 1
;DAC Value
;DAC Address
;high byte of 16-bit answer
;low byte of answer
;
;arbitrary start
;set serial
;data mode 0
;clr transmit flag
;/RS, /SHDN, /CS high
;set the /CS low
;put DAC value in shift register
;
;send the address byte
;wait until 8 bits are sent
;clear the serial transmit flag
;send the DAC value
;
;
;wait again
;clear serial flag
;/CS high, latch data
; into AD8801
;Shift 8 bits
;Get source byte
;Rotate MSB to carry
;Save new source byte
;Get destination byte
;Move carry to MSB
;Save
;Done?
Listing 1. Software for the 8051 to AD8802/AD8804 Serial Port Interface
8051 µC
PORT 1 1.7 1.6 1.5 1.4
+5V
P1.7
P1.6
P1.5
P1.4
VDD VREFH
AD8804
SDI
O1
CLK
CS
O12
SHDN
GND VREFL
Figure 25. An AD8802/AD8804-8051 µC Interface Using
Parallel Port 1
to start the serial interface process. The DAC address is loaded
into the accumulator and four Rotate Right shifts are per-
formed. This places the DAC address in the 4 MSBs of the ac-
cumulator. The address is then sent to the AD8802/AD8804 via
the SEND_SERIAL subroutine. Next, the DAC value is loaded
into the accumulator and sent to the AD8802/AD8804. Finally,
the Chip Select input is set high to complete the data transfer
Unlike the serial port interface of Figure 24, the parallel port in-
terface only transmits 12 bits to the AD8802/AD8804. Also, the
BYTESWAP subroutine is not required for the parallel inter-
face, because data can be shifted out MSB first. However, the
results of the two interface methods are exactly identical. In
most cases, the decision on which method to use will be deter-
mined by whether or not the serial data port is available for
communication with the AD8802/AD8804.
–10–
REV. 0

Share Link: 

datasheetq.com  [ Privacy Policy ]Request Datasheet ] [ Contact Us ]