Let's take another look at the last program posted:
How can you RESUME if you didn't get there with an interrupt in the first place?Code:-code-removed-here ............................ if CNTL_BUTTON = 1 then spacing = 30 goto direct 'If button is released before 2 secs 'code goes directly into the default spacing -more-code-removed-here ............................ direct: spacing = 255 - (spacing * 4) OPTION_REG = %00110000 ' TMR0, counter set option_reg<5> clear for timer ' Option_Reg<4> set for falling edge clear for ' rising edge detection. ON INTERRUPT GOTO ISR ' Interrupt service routine TMR0 = spacing OUT_PIN = 0 INTCON = %10100000 ' Enable TMR0 overflow interrupt 'This is the interrupt service routine, ISR. The program jumps here whenever TMR0 overflow occurs DISABLE 'Disable interrupts ISR: 'Entry point of the ISR OUT_PIN = 1 TMR0 = spacing INTCON.2 = 0 ' Reset timer interrupt flag RESUME ' Resume main program end
What happens to a program if you RETURN without a GOSUB? Or in this case, RETFIE without an INTERRUPT?
Now re-read post #7 and you'll see why I posted what I did...




Bookmarks