datasheetbank_Logo
Integrated circuits, Transistor, Semiconductors Search and Datasheet PDF Download Site

AD8303AR View Datasheet(PDF) - Analog Devices

Part Name
Description
View to exact match
AD8303AR Datasheet PDF : 16 Pages
First Prev 11 12 13 14 15 16
AD8303
;AD8303.ASM
;
; This subroutine loads an AD8303 shift register with a 12-bit
; DAC value, and transfers the value to DAC A or DAC B.
; The DAC value is stored at location DAC-VAL1 (MSB) and DAC_VAL0 (LSB)
; The DAC address (A or B) is stored at DAC_ADDR, (b0=0 for A, b1=0 for B)
;
; Primary controls
$MOD51
$TITLE(AD8303 Interface, Using the Serial Port in Mode 0)
;
; Variable declarations
;
PORT1
DATA 90H
;SFR register for port 1
DAC_VAL0 DATA 40H
;LSBs of 12-bit DAC Value
DAC_VAL1 DATA 41H
; MSBs of DAC Value
DAC_ADDR DATA 42H
;DAC address, format is:
; 1,1,1,1,1,1,LDB,LDA
; Set bit low to select DAC
LOOPCOUNT DATA 43H
;Count loops for byte swap
SHIFTREG DATA 44H
;Shift reg. for byte swap
SENDBYTE DATA 45H
; Destination reg. for SR
;
ORG
100H
;arbitrary starting address
DO_8303: CLR
SCON.7
;set serial
CLR
SCON.6
; data mode 0
CLR
SCON.5
;Clr SM2 for mode 0
CLR
SCON.1
;Clr the transmit flag
MOV
SHIFTREG,DAC_VAL1
;Get Most Significant Byte
ACALL SEND_IT
; send to AD8303
MOV
SHIFTREG,DAC_VAL0
;Get Least Significant Byte
ACALL SEND_IT
; send it to the AD8303
MOV
A,PORT1
;Get I/O port contents
ANL
A,DAC_ADDR
;Clr LDA/LDB, other bits unchanged
MOV
PORT1,A
;Send to I/O port
ORL
A,#00000011B
;Set LDA and LDB high
MOV
PORT1,A
;Send to I/O port
RET
;Done
;
;Convert the byte to LSB-first format and send it to the AD8303
SEND_IT: MOV
LOOPCOUNT,#8
;Shift 8 bits
BYTESWAP: MOV
A,SHIFTREG
;Get source byte
RLC
A
;rotate MSB to carry
MOV
SHIFTREG,A
;Save new source byte
MOV
A,SENDBYTE
;get destination byte
RRC
A
;Move carry into MSB
MOV
SENDBYTE,A
;Save
DJNZ
LOOPCOUNT,BYTESWAP
;Done?
MOV
SBUF,SENDBYTE
;Send the byte
SEND_WAIT: JNB
SCON.1,SEND_WAIT
;Wait until 8 bits are send
CLR
SCON.1
;Clear the serial flag
RET
;Done
END
Figure 35. Software Listing for the AD8303-80CL51 Interface
–14–
REV. 0
 

Share Link: 

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