Yes I agree. When I first thought about it I could see there was a problem with placing the code in the right place. However a look through the manual reveals that you can insert it in a file PBH.INC in the INC subdirectory. I quote " The interrupt handler itself may be placed in the file PBH.INC in the INC subdirectory. Near the end of the file is the label Start. This is where the PICmicro MCU will start executing code on reset, location 0. A few lines down is a section of code that has been commented out. If this code is uncommented, it will enable you to insert your interrupt handler at location 4. Place your assembly language interrupt handler routine after the ORG 4. The routine should end with an RETI instruction to return from the interrupt and allow the processor to pick up where it left off in your PicBasic program." The one last problem is forcing the WSAVE etc variables into the correct bank to make them available where ever the interrupt gets you. It should be possible but I have not found it yet. Still with that in mind you can then use something like this:- PS This is just the interrupt code not the Basic required to initialise TMR1 to start running interrupt etc. Tim MOVWF WSAVE ; SAVE THE W REG SWAPF STATUS,W ; SAVE THE STATUS REG CLRF STATUS MOVWF SSAVE MOVF PCLATH,W ; SAVE THE PCLATH REG MOVWF PSAVE TMR1_VAL =((65536)-(OSC*1250))+7 ; CALCULATE OSC OFFSET VALUES FOR 200HZ INTERRUPTS (OSC = FREQ IN MHZ) BCF T1CON,TMR1ON ; TURN OFF TIMER MOVLW LOW(TMR1_VAL) ADDWF TMR1L,F ; RELOAD TIMER WITH CORRECT VALUE BTFSC STATUS,C INCF TMR1H,F MOVLW HIGH(TMR1_VAL) ADDWF TMR1H,F BSF T1CON,TMR1ON ; TURN IT BACK ON BTFSS PORTX,X GOTO SETBIT BSC PORTX,X ; TOGGLE PORT,X BIT X GOTO EXIT SETBIT BSF PORTX,X EXIT BCF PIR1,0 ; CLEAR TMR1 INTERRUPT FLAG MOVF PSAVE,W ; RESTORE THE PCLATH REG MOVWF PCLATH SWAPF SSAVE,W ; RESTORE THE STATUS REG MOVWF STATUS SWAPF WSAVE,F SWAPF WSAVE,W ; RESTORE W REG RETFIE ; EXIT THE INTERRUPT ROUTIN -----Original Message----- From: pic microcontroller discussion list [mailto:PICLIST@MITVMA.MIT.EDU]On Behalf Of Jinx Sent: Wednesday, March 19, 2003 8:51 AM To: PICLIST@MITVMA.MIT.EDU Subject: Re: [PIC]: Timer Module > Sid > > If I remember right Pbasic does not have an ON_INTERRUPT > command nor does it have a HPWM command Can you use asm routines with Pbasic ? A timer interrupt in asm would be fairly trivial -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics