PDA

View Full Version : Interrupts on 18F2525



Tom Gonser
- 26th March 2005, 02:37
I am moving a program from a 16F876/a to an 18F2525, and there is one interrupt in the program on PortB.0.

The code sets up the interrupt using the 16 timer, and now I need to move it to the 18 part, that has multiple interrupts. The code as ported 'sorta' runs on the new part, but the interrupt does not. (not sure what else doesn't yet).

This is my interrup from the 16 part:
-------------------------------------------

On Interrupt Goto ProcedureSwitcher

ReStart:
TMR1H = 0
TMR1L = 0 ' Clear time counts before Timer1 re-start
PIR1.0 = 0 ' CLear over-flow flag before enable
T1CON.0 = 1 ' Turn Timer1 back on before entry into MainProcedure

...... (program here )..............

NextStage: ' Dont really know what you need here. Just a visual test
' T1CON.0 = 0 ' Turn off Timer1 if you need to here
Timer = 0 ' Clear Timer var on entry here


Disable ' Disable interrupts in handler
ProcedureSwitcher:
Bmenu = Bmenu + 1 ' Changing task
If Bmenu = 7 Then Bmenu=1
serout2 Apinout, 16468, [I,CLR]
serout2 Apinout, 16468,[I,L1_C1]
serout2 Apinout, 16468, ["Using Menu #: ",#Bmenu]
pause 500



Here:
While SWITCH = 0 ' waiting until
wend ' push-button is release
pause 100 ' debounce time
If switch = 0 then here
PIR1.0 = 0 ' Clear Timer1 over-flow flag
Timer = 0 ' Clear Timer counts before return
INTCON.1=0 ' reset RB0 interrupt flag
Resume ' Return to main program

Enable ' Enable interrupts after
' handler


end


In the 18 part, the timers are different and Interrups are referred to differently also. I need to make an interrupt on B0 and one on B1 that will allow me to have a 'menu system' where B0 will break in, and display a menu, and B1 will select the menu.

Anyone have any experience with interrups on the 18 parts?

Thanks,

Tom