beautypg.com

Texas Instruments TMS320C2XX User Manual

Page 502

background image

Task-Specific Program Code

C-17

Program Examples

Example C–11. Testing and Using Automatic Baud-Rate Detection on

Asynchronous Serial Port (autobaud.asm) (Continued)

uart:

setc

xf

in

68h,iosr

; load input status from iosr

bit

68h,1

; check if auto baud bit is set

bcnd

rcv,ntc

; branch normal receive

splk

#4fffh,67h

; clear ADC

out

67h,iosr

splk

#0e080h,67h

out

67h, aspcr

; Disable CAD bit/auto baud

rcv:

in

68h,iosr

; check for DR bit

bit

68h,7

; bit 8 in the data

bcnd

skip,ntc

; IF DR=0 no echo, return

in

*,adtr

; read and save at 300h

out

*+,adtr

; echo

mar

*,ar0

banz

skip,ar1

; check if size=0, and reload

lar

ar1,#rxbuf

lar

ar0,#size

skip:

splk

#0020h,ifr

; Clear ifr

clrc

intm

ret

inpt1:

ret

inpt23:

ret

timer:

ret

codtx:

ret

codrx:

ret
.end

; Assembler module end directive
; –optional