![]() | ![]() | ![]() |
| | |||||||
| Robotics Chat Specific to discussions about robots and the making of. |
| | LinkBack | Thread Tools | Display Modes |
| | (permalink) |
| It's been a while since I last worked on my bot and I'm stuck with trying to get the TMR0 interrupt to handle the stepper pulse. The thing is...the interrupt isn't happening. Can you spot why? Code: Interrupt org 0x04 ; interrupt vector movwf W_TEMP ; swapf STATUS,W movwf S_TEMP bcf STATUS,RP0 Disable_Int bcf INTCON,GIE ; btfsc INTCON,T0IF ; goto Step ; ; btfsc PIR1,TMR2IF ; ; goto Left_Step ; Pop swapf S_TEMP,W ; movwf STATUS swapf W_TEMP,f swapf W_TEMP,w retfie ;****The main program***** #include "Bot.inc" Start CLRF PORTA ; Initialize Port A CLRF PORTB ; Initialize Port B CLRF PORTC ; Initialize Port C CLRW BANK1 ; Select Register Bank 1 MOVWF TRISB ; Set B to all outputs for stepper control BANK0 CLRF TMR0 ; Clear Timer0 register CLRF INTCON ; Disable interrupts and clear T0IF BANK1 MOVLW 0xC7 ; PortB pull-ups are disabled, MOVWF OPTION_REG ; Interrupt on rising edge of RB0 ; Timer0 increment from internal clock ; with a prescaler of 1:256. BANK0 BSF INTCON, T0IE ; Enable Timer0 Interrupts BSF INTCON, GIE ; Enable all interrupts BSF INTCON, PEIE
__________________ Here...let me improve it for you! *Puff of smoke* ....oops... | |
| |
| | (permalink) |
| You need to clear the TMR0IF flag before you exit the ISR.You dont seem to be doing so. | |
| |