igeorge
Member level 5
I have problem starting iterrupt 0
I setup the following interrupt routine and i have on the display settup to see the counter running
When i start, nothing happen
timer does not start
I am using Mikrobasic from Mikroelectronica, but any sugestion will be good, and i can implement it
here is the initialization at start program
then this is the interrupt service routine
and this is the display of the counter
the counter is dead.
Please help
Thank you
Ion
I setup the following interrupt routine and i have on the display settup to see the counter running
When i start, nothing happen
timer does not start
I am using Mikrobasic from Mikroelectronica, but any sugestion will be good, and i can implement it
here is the initialization at start program
Code:
INTCON.7 = 1 'GIE IS SET == GLOBAL INTRRUPT ENABLE BIT
INTCON.2 = 0 ' START TIMER
INTCON2.2 = 1 'TMR0IP SET TO 1 ;TIMER 0 INTERUPT PRIORITY ==HIGH
RCON.7 = 1 'INTERUPT PRIORITY ENABLE IPEN SET TO 1
T0CON.7 = 1 'ENABLE TIMER 0 ; IF 0 STOP TIMER 0
T0CON.6 = 0 'SET TO 16 BITS
T0CON.5 = 0 'SELECT INTERNAL CLOCK
T0CON.3 = 0 'IT WILL USE THE PRESCALLER
Code:
sub procedure interrupt ' Define interrupt subprocedure
IF TMR0IF = 1 THEN
cnt = cnt +1 ' Increment variable cnt by 1
INTCON.2 = 0
TMR0L = 0
TMR0H = 0
end if
end sub ' End of interrupt routine
and this is the display of the counter
Code:
if cnt > 2000 then
porte.1 = 1
delay_ms(600)
porte.1 = 0
cnt = 0
TMR0L = 0
TMR0H = 0
end if
Please help
Thank you
Ion
Last edited: