C-10 – Texas Instruments TMS320C2XX User Manual

Page 495

Advertising
background image

Task-Specific Program Code

C-10

Example C–6. Testing and Using Interrupt INT1 (intr1.asm)

* File:

intr1.asm

*

* Function: Interrupt test code

*

* For each INT1 interrupt XF,I/O pins IO3 and IO2 will toggle and

*

* transmit char ’c’ through UART

*

.title ”Interrupt 1 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

splk

#0ffffh, ifr

; clear interrupts

splk

#0001h, imr

; Enable int1 interrupts

splk

#0010h, 60h

out

60h,icr

; Enable Intr1 in mode bit/ICR

splk

#0000h, 60h

out

60h, wsgr

; Set zero wait states

splk

#0e00ch, 60h

; configure I03 and IO2 as outputs

out

60h, aspcr

; set the aspcr for the above

splk

#0411h, 60h

; default baud rate 1200, for UART @50 ns

out

60h,brd

mar

*,ar1

; Initialize AR pointer with AR1

lar

ar1,#rxbuf

lar

ar0,#size

; set counter limit

splk

#0004h,61h

; set bit I/O 2

splk

#0008h,62h

; set bit I/O 3

splk

#0063h,63h

; set tx data

clrc

INTM

clrc

XF

wait:

out

61h,iosr

; toggle IO2/3

idle
clrc

XF

; toggle xf

b

wait

inpt1:

in

65h, icr

; Read icr

out

62h, iosr

; toggle IO2/3

out

65h, adtr

; send icr value through UART to check
; interrupt source

setc

XF

; toggle xf

clrc

INTM

ret

timer:

ret

inpt23:

ret

uart:

ret

codtx:

ret

codrx:

ret
.end

; Assembler module end directive
; –optional

Advertising