ad8804aru-reel Analog Devices, Inc., ad8804aru-reel Datasheet - Page 11

no-image

ad8804aru-reel

Manufacturer Part Number
ad8804aru-reel
Description
12 Channel, 8-bit Trimdacs With Power Shutdown
Manufacturer
Analog Devices, Inc.
Datasheet
An MC68HC11-to-AD8802/AD8804 Interface
Like the 8051 C, the MC68HC11 includes a dedicated serial
data port (labeled SPI). The SPI port provides an easy interface
to the AD8802/AD8804 (Figure 27). The interface uses three
lines of Port D for the serial data, and one or two lines from
Port C to control the SHDN and RS (AD8802 only) inputs.
REV. 0
; This 8051 C subroutine loads an AD8802 or AD8804 DAC with an 8-bit value,
; using the 8051’s parallel port #1.
; The DAC value is stored at location DAC_VALUE
; The DAC address is stored at location DAC_ADDR
;
; Variable declarations
PORT1
DAC_VALUE
DAC_ADDR
LOOPCOUNT
LD_8804:
SEND_SERIAL:
Figure 26. An AD8802/AD8804-to-MC68HC11 Interface
MC68HC11*
(PD3)
*ADDITIONAL PINS OMITTED FOR CLARITY
(PD4)
(PD5)
MOSI
SCK
PC0
PC1
SS
DATA
DATA
DATA
DATA
;
ORG
ORL
CLR
MOV
MOV
RR
RR
RR
RR
ACALL
MOV
MOV
ACALL
SETB
RET
RLC
MOV
CLR
SETB
DJNZ
RET;
END
Listing 2. Software for the 8051 to AD8802/AD8804 Parallel Port Interface
SDI
CLK
CS
SHDN
RS (AD8802 ONLY)
AD8804*
AD8802/
41H
43H
PORT1,#11110000B
A
90H
40H
100H
PORT1.5
LOOPCOUNT,#4
A,DAC_ADDR
A
A
A
A
SEND_SERIAL
LOOPCOUNT,#8
A,DAC_VALUE
SEND_SERIAL
PORT1.5
PORT1.7,C
PORT1.6
PORT1.6
LOOPCOUNT,SEND_SERIAL
–11–
A software routine for loading the AD8802/AD8804 from a
68HC11 evaluation board is shown in Listing 3. First, the
MC68HC11 is configured for SPI operation. Bits CPHA and
CPOL define the SPI mode wherein the serial clock (SCK) is
high at the beginning and end of transmission, and data is valid
on the rising edge of SCK. This mode matches the requirements
of the AD8802/AD8804. After the registers are saved on the
stack, the DAC value and address are transferred to RAM and
the AD8802/AD8804’s CS is driven low. Next, the DAC’s ad-
dress byte is transferred to the SPDR register, which automati-
cally initiates the SPI data transfer. The program tests the SPIF
bit and loops until the data transfer is complete. Then the DAC
value is sent to the SPI. When transmission of the second byte is
complete, CS is driven high to load the new data and address
into the AD8802/AD8804.
;SFR register for port 1
;DAC Value
;DAC Address (0 through 7)
;COUNT LOOPS
;arbitrary start
;set CLK, /CS and /SHDN high
;Set Chip Select low
;Address is 4 bits
;Get DAC address
;Rotate the DAC
;address to the Most
;Significant Bits (MSBs)
;
;Send the address
;Do 8 bits of data
;Send the data
;Set /CS high
;DONE
;Move next bit to carry
;Move data to SDI
;Pulse the
;CLK input
;Loop if not done
AD8802/AD8804

Related parts for ad8804aru-reel