Texas Instruments TMS320C2XX Calculator User Manual


 
Task-Specific Program Code
C-13
Program Examples
Example C–9. Asynchronous Serial Port Transmission (uart.asm)
* File: uart.asm *
* Function: UART Test Code *
* Continuously sends ’’C203 UART is fine’ at 1200 baud. *
.title ” UART Test” ; Title
.copy ”init.h” ; Variable and register declaration
.copy ”vector.h” ; Vector label declaration
.text
start: clrc CNF ; Map block B0 to data memory
ldp #0h ; set DP=0
setc INTM ; Disable all interrupts
* UART initialization *
splk #0ffffh,ifr ; clear interrupts
splk #0000h,60h
out 60h, wsgr ; Set zero wait states
splk #0c180h,61h ; reset the UART by writing 0
out 61h, aspcr ; 1 stop bit, tx interrupt, input i/o
splk #0e180h,61h ; Enable the serial port
out 61h,aspcr
splk #4fffh,62h
out 62h,iosr ; disable auto baud
splk #0411h, 63h ; set baud rate =1200 @ 20-MHz CLKOUT1
out 63h, brd
splk #20h,imr ; enable UART interrupt
mar *,ar1 ; ARP=ar1
lar ar1,#rxbuf
* Load data at DM300 ; ’c203 UART is fine!’ – xmit data
splk #0063h,*+ ; ascii value for the above characters
splk #0032h,*+
splk #0030h,*+
splk #0033h,*+
splk #0020h,*+
splk #0055h,*+
splk #0041h,*+
splk #0052h,*+
splk #0054h,*+
splk #0020h,*+
splk #0069h,*+
splk #0073h,*+
splk #0020h,*+
splk #0066h,*+
splk #0069h,*+
splk #006eh,*+
splk #0065h,*+
splk #0020h,*+
splk #0021h,*+
splk #0021h,*+
splk #0020h,*+