thanks for your time , i cant get the btfsc to work in my prog. btfsc status.z for the timer won't come in. the value is loaded into tmr0 but status doesn't change when tmr0 times out.so btfsc won't jump over. after sttimer times out tmr0 loaded with value o/ps toggle if tmr0 hasn't timed out (btfsc jumps) too decrement strttmr then go back & toggle o/ps again i don't know how to find the prob in the code ( around tmr0 , status & btfsc ) i tried it with intcon,to1f(commered out) but that didn't work either thanks for your time. I REAllY APPRECIATE IT !! glen this is all the code . * ;********************************************************************** list p=16F84 ; list directive to define processor #include ; processor specific variable definitions __CONFIG _CP_OFF & _WDT_OFF & _PWRTE_OFF & _XT_OSC ;********************************************************************** ; vars STATUS equ 0x03 ;CPU equates (program memory map) PORTA equ 0x05 ;CPU equates (program memory map) PORTB equ 0x06 ;CPU equates (program memory map) strttmr equ 0x0C ; no of counts counta equ 0x0D ;value of the start timeout low value countb equ 0x0E ;value of the start timeout high value togl equ 0x0F togh equ 0x10 chksw equ 0x11 ; w equ 0 ; destination designators f equ 1 ; destination designators ;Z equ 0 ;********************************************************************** org 0x000 ;address 000 program start GOTO start ;jump over table ;********************************************************************** table ANDLW 0x03 CLRF PCLATH ADDWF PCL retlw .25 ;d'25' ; 00 : 250ms (switch position 1) ; retlw .50 ;d'50' ; 01 : 500ms (switch position 2) ; retlw .75 ;d'75' ; 10 : 750ms (switch position 3) ; retlw .100 ;d'100' ; 11 : 1000ms (switch position 4) ;********************************************************************** ; porta set-up start MOVLW 0xff ;ff hex moved to w register tris PORTA ;porta set as inputs ; ;********************************************************************** ; PORTB set-up MOVLW 0x0f ;00001111 hex moved to w register tris PORTB ;PORTB set o/p's 4,5,6,7,inputs 0,1,2,3 ; ;********************************************************************** CLRF STATUS CLRF PCLATH ;============= prescaler setup ===pullups enabled=========== MOVLW b'00000111' ;scale 1:256 , pullups enabled OPTION ;============= counter setup ============== ;code below is used for 2 switches to select a value (0-3) ; from lookup table & place into strttmr nop ;WON'T WORK WITHOUT THIS NOP IN PROG nop nop MOVF PORTB,W ;get values of RB0 & RB1 ANDLW 0x03 ; extract out bits 0,1 of PORTB (strttmr sw value) MOVWF chksw ;put rb0 & rb1 values in register chksw CALL table ; use look up table MOVWF strttmr ;move selected value from table to strttmr ;********************************************************************** ;============== program start ============= MOVLW 0x00 ;move 00 hex to register w MOVWF PORTB ;move register w to PORTB (clear PORTB) ;============= prescaler setup ===pullups disabled=========== MOVLW b'10000111' ;scale 1:256 , pullups disabled OPTION ; ============= initialise timer setup ============== chcycs BTFSC PORTB,3 ;check AC input at port b pin 2 for 0 GOTO chcycs ;check again if still high lw BTFSS PORTB,3 ;check AC input at port b pin 2 for 1 GOTO lw ;check again if still low CALL sttimer initmr MOVLW .215 ;40 * .000256 = 10 ms MOVWF TMR0 togs CALL tog ;============= check timer ======== MOVF TMR0,w ;move f reg to w ; BTFSS INTCON,T0IF ; GOTO togs ; decfsz strttmr,f ;decrement strttmr by 1 ; GOTO initmr ;go around for next delay BTFSC STATUS,Z ;if !0 ,GOTO loop GOTO togs ; DECFSZ strttmr,f ;decrement strttmr by 1 GOTO initmr ;go around for next delay MOVLW b'00000000'; MOVWF PORTB ; ;drop thru to stop stop GOTO stop ;======================================================================= ;********************* delay sub-routines ******************************* ;============== start timer ============= sttimer MOVLW 0x02 ; MOVWF counta ; dela DECFSZ counta ; GOTO dela ; MOVLW 0x02 ; MOVWF countb ; delb DECFSZ countb ; GOTO delb ; RETURN ; ;==============toggle outputs ============= tog MOVLW b'00110000' MOVWF PORTB MOVLW 0x02 MOVWF togl delh DECFSZ togl GOTO delh MOVLW b'00000000' MOVWF PORTB MOVLW 0x02 MOVWF togh dell DECFSZ togh GOTO dell ; go & toggle o/ps RETURN ;********************************************************************** END ; directive 'end of program'