Excellent!! just a minor bit of subtraction to find the actual number of samples and home free. Many thanks. dwayne > >Sure! This will get you back down to 5 cycles per sample and >it can be scaled to how ever many bytes you wish. I show 3 >just as an example. > > MOVLW C_LOW > MOVWF count_low > > MOVLW C_MID > MOVWF count_mid > > MOVLW C_HIGH > MOVWF count_high > >s1: > BTFSC IOPORT,IOBIT > goto went_high > > DECFSZ count_low,F > goto s1 > > NOP > > BTFSC IOPORT,IOBIT > goto went_high > > DECFSZ count_mid,F > goto s1 > > NOP > > BTFSC IOPORT,IOBIT > goto went_high > > DECFSZ count_high,F > goto s1 > >time_out: > >The three-byte count is pre-loaded with the desired time-out. If >the code reaches the label 'time_out' then the IOPORT didn't >change states. > >One caveat: The three byte count is actually: > >COUNT = C_LOW + 257*C_MID + 257^2 * C_HIGH > >(note 257 and not 256). So to preset the count you'll need to do >something like: > > >C_LOW EQU COUNT % 257 >C_MID EQU (COUNT / 257) % 257 >C_HIGH EQU (COUNT / 257 / 257) % 257 > >Scott > >