
SLAA108A
8 SPI-Based Data Acquisition/Monitor Using the TLC2551 Serial ADC
Write_DAC bis.b #001h,&P3OUT ; Turn on LED of F149 Board
swpb R12 ; Swap Bytes
add.w R12, R13
and.w #0xFFF0, R12 ; Strip trailing bits
rrc.w R12 ; Shift data 4 places
rrc.w R12 ; to conform to
rrc.w R12 ; DAC input format
rrc.w R12 ; Data is shifted!
and.w #0x0FFF, R12 ; Strip any carries
add.w #0x4000, R12 ; Set DAC Fast Mode, 0x4000
bic.b #FS,&P3OUT ; Clear FS to DAC
bic.b #DAC_CS,&P3OUT ; Enable /CS to DAC
bis.b #FS,&P3OUT ; Toggle FS to prepare DAC
bic.b #FS,&P3OUT ; to recieve DATA
swpb R12 ; Align MSB First
mov.b R12,&U0TXBUF ; Transmit upper Data Byte to DAC
call #CLEAR
swpb R12 ; Prepare Lower Byte
mov.b R12,&U0TXBUF ; Transmit lower Data Byte to DAC
call #CLEAR
bis.b #DAC_CS,&P3OUT ; Disable /CS to DAC
bis.b #FS,&P3OUT ; Set Frame Sync
bic.b #001h,&P3OUT ; Turn off LED of F149 Board
jmp Mainloop ; Repeat
;*******************************
; Clear TX Flag
;*******************************
CLEAR
bit.b # UTXIFG0,&IFG1; TXBUF ready?
jnc CLEAR ; 1 = ready
bic.b # UTXIFG0,&IFG1
ret
;************************************************************************
Init_Sys; Modules and Controls Registers set-up subroutine
;************************************************************************
StopWDT mov #WDTPW+WDTHOLD,&WDTCTL ; Stop Watchdog Timer
Kommentare zu diesen Handbüchern