The PIC16C84 has the interupt at org 4 I don't see you saving the registers after going into interupt and returning the registers when returning (you should have a RETFIE, not a return) _w equ 10 _status equ 11 org 4 Interrupt movwf _w ;save work movf STATUS, w bcf STATUS, RP0 ;puts the pic register in a know page (optional) movwf _status ;save status bcf INTCON, 1 ;clear INTF in INTCON register bcf INTCON, 2 ;ckear TOIF in INTCON register Do your other interupt code here RETFIE ;puts the PC at Top of Stack (where the interupt came from) Mathew Cohen wrote: > I believe that this is the interupt vector location for the 16f84. In > software simulation it seems to work. If this is not the case than could > someone please set me straight. Also it ahs been brought to my attention > that I seem to have left the global interupt bit low this is probably why > the code does not work . > Can someone test it thanks. > > Regards > > Mathew Cohen > > ----- Original Message ----- > From: Martin Schdfer > To: > Sent: Wednesday, October 20, 1999 10:21 PM > Subject: Re: Why doesn't this code work ??? > > > Hi Mathew, > > > > why is your interrupt starting at H'03' ? > > > > Mathew Cohen schrieb: > > > > > Hi All, Can someone tell me why the following code will not work. Is > > > this the correct way to initilise the timer and use the timer overflow > > > interupt. Thanks in advance Mathew Cohen ORG > > > H'50' Start > > > Call Initporta > > > Call Initportb > > > Call Initmr > > > GOTO > > > Checkswitch > ;-------------------------------------------------------------------------- > > > ORG H'03' > > > TmrInterupt BTFSC PORTB,7 > > > call Initmr > > > goto toggleleds Initmr > > > CLRF TMR0 > > > BSF STATUS,RP0 ;select bank 1 > > > CLRF OPTION_REG > > > MOVLW B'00000111' > > > IORWF OPTION_REG,1 > > > BCF INTCON,T0IF > > > BSF INTCON,T0IE RETURN > > > Initporta BSF STATUS,RP0 > > > MOVLW 0 > > > TRIS PORTA > > > BCF STATUS,RP0 > > > MOVLW 31 > > > MOVWF PORTA RETURN Initportb BSF STATUS,RP0 > > > MOVLW H'FF' > > > MOVWF TRISB > > > BCF STATUS,RP0 > > > RETURN Checkswitch > > > BTFSS PORTB,7 > > > BSF PORTA,4 > > > BTFSC PORTB,7 > > > BCF PORTA,4 > > > GOTO Checkswitch > > > toggleleds > > > > > > BTFSS PORTA,1 > > > goto LedsOFF > > > BTFSC PORTA,1 > > > goto Ledson > > > > > > Ledson MOVLW 15 > > > MOVWF PORTA > > > CALL Initmr > > > GOTO Checkswitch > > > LedsOFF > > > > > > MOVLW 0 > > > MOVWF PORTA > > > CALL Initmr > > > GOTO Checkswitch > > > > > > END > >