A couple of changes. If you don't see the LED blink, turn up the prescaler and/or use a slower oscillator for test. At least you should see it work.Code:define loader_used 1 define osc 20 led var portc.1 ;LED is connected on PortC.1 ledcnt var word wsave var byte $20 system ssave var byte bank0 system psave var byte bank0 system Goto main define INTHAND tmroverflow asm tmroverflow movwf wsave swapf STATUS, W clrf STATUS movwf ssave ;Interrupt movf PCLATH, W ;Routine movwf psave ;with Save function inc _ledcnt ;increment the counter movf psave, W movwf PCLATH swapf ssave, W movwf STATUS swapf wsave, F swapf wsave, W bcf intcon,2 ;Clear Interrupt Flag retfie ENDASM main: INTCON = %10100000 ;GIE enabled, T0IE enabled OPTION_REG = %00000101 ;Prescaler on TMR0 rate 1:32 Output LED loop: led = ledcnt.7 ;make the led follow bit 7 of ledcounter goto loop ;Wait here for interrupt
Bookmarks