hi & sorry again ! i don't know how to get around this problem !! i still can't get the table to work properly ! the table puts the first value into strttmr regardless of the switch settings **how do i get the switch settings value to access the corresponding value in the lookup table & place it into strttmr? *** eg switch setting = 1 0 (rb0 = 1 , rb1 = 0 ) table value at 10 = d'75' put d'75' into strttmr the problem area is in the section 'select switch setup ' ;************************ports setup**************************** ;********************************************************************** clrf STATUS ;============= prescaler setup ===pullups enabled=========== movlw b'00000111' ;scale 1:256 , pullups enabled OPTION ;********************************************************************** ;********************************************************************** ; ============= select switch setup ============== ;code below is used for 2 switches ; init strttmr from input pins movf PORTB,w ;get values of RB0 & RB1 andlw 0x03 ; extract out bits 0,1 of PORTB (table sw value) movwf chksw ;put rb0 & rb1 values in register chksw caltab CALL table ; use look up table movwf strttmr ;move selected value from table to strttmr xorwf chksw ;compare with chksw value (switch value) btfsc STATUS,Z ;if same , skip next instruction GOTO caltab ;******************TABLE TO GO IN SUB ROUTINES*********************** table addwf PCL,f ;sw value : time : retlw d'25' ; 00 : 250ms (switch position 1) retlw d'50' ; 01 : 500ms (switch position 2) retlw d'75' ; 10 : 750ms (switch position 3) retlw d'100' ; 11 : 1000ms (switch position 4) ;********************************************************************** ;********************************************************************** ; ============== 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 ============== initmr movlw .215 ;40 * .000256 = 10 ms movwf TMR0 loop CALL chcycs ;check for zero crossing CALL sttimer ;call initial time delay CALL tog ;toggle outputs ; ============= check timer ============== movf TMR0,w ;move f reg to w btfsc STATUS,Z ;if !0 ,GOTO loop GOTO loop decfsz strttmr,f ;decrement strttmr by 1 GOTO initmr ;go around for next delay ;drop thru to stop stop GOTO stop ;======================delay sub-routines======================= ; end thanks very much for your help because i'm LOST !! glen