Dave
Always wear safety glasses while programming.
Thanks for taking a look at this guys. I read through everything on Davids page but I'm making not progress. I need to establish variables in my main program, then, when the interrupt occurs, change those variables. I'm not seeing a good way to do this at the moment since, as was pointed out, the variables are saved then recalled after the interrupt, effectively bypassing any change made during the interrupt.
User variables are not saved and restored for the interrupts. Only PBP's SYSTEM variables are.
But PORTB Change Interrupts (RBC_INT) only work on PORTB.4-7 on the 16F887.
You are testing PORTC pins in the ISR.
DT
Thanks Darrel. I tried this:
asm
INT_LIST macro
INT_Handler RBC_INT, _Change, PBP, yes
endm
INT_CREATE
endasm
@ INT_ENABLE RBC_INT
Oscloop:
high portd.1
pauseus ontime
low portd.1
pauseus offtime
goto oscloop
Change:
portd.0=1
if portb.4=1 and ontime<1000 then ontime=ontime+1
if portb.5=1 and ontime>10 then ontime=ontime-1
if portb.6=1 and offtime<10000 then offtime=offtime+10
if portb.7=1 and offtime>1210 then offtime=offtime-10
@ INT_RETURN
The above works well. The thing is, with the original program, I was triggering the int with a rising edge on portb.0 then sending the necessary change bit over portc.0-3. The timing was generous, portb.0=1 for 100ms (not that this matters as it should have been a rising edge trigger anyway) then which ever ever portc was active was held high for 100ms as well. The timing was verified with a scope, as was entrance into the change routine by the ISR. Why did that not work?
Thanks again!
Bookmarks