This program is based on code kelvinu posted in another thread. I cannot get the interrupt/pin toggle to work, and I don't have enough assembly experience to identify the problem. The code below is supposed to set one pin high in a main loop and toggle another pin with a timer interrupt, but the states of the pins never change. They just remain low. What's wrong with my program? (Please note: I only started a new thread because, for some unknown reason, I was not allowed to insert source code when I tried to post it as a reply to the original thread. I apologize if posting in a new thread offends any forum members, as it is not my intent to offend or annoy anyone with this thread.)
Regards,
-Cypress
.include "xc.inc"
.bss
intcounter: .space 2
.text
.global __reset
.global __T1Interrupt
__reset:
BCLR TRISB, #5
BCLR TRISB, #6
;********************** ;setup timer 1 for interrupt
clr TMR1
mov #200,w12
mov w12,intcounter
mov #16000,w7
mov W7,PR1
bclr IFS0,#T1IF
bset IEC0,#T1IE
bset T1CON,#TON
bclr IFS1,#CNIF
__T1Interrupt:
push.s
dec intcounter
btss SR,#Z
bra intcnotzero
btg LATB,#6
mov #500,w0
mov w0,intcounter
intcnotzero:
bclr IFS0, #T1IF
pop.s
retfie
loop:
bset LATB, #5
BRA loop
Regards,
-Cypress