Reginald Neale wrote: > > Esteemed PIC Gurus: > > Does anyone have a favorite way to do a window comparison on an A/D > result? Seems to me there was one here a week ago, but it has eluded > me. > > What I want to do is to insert code in an existing loop that will set > an alarm output pin if the A/D result falls outside the window; set > another pin high if it is below the hard-coded lower limit, set a > different pin if it is above the upper limit, and continue on without > setting any of the three if the result is within the window. > > TIA, > Reg Neale movf ADres,w sublw UpLimit btfss status,c goto TooHigh movlw LoLimit subwf ADres,w btfss status,c goto TooLow -- Best regards Tony http://www.picnpoke.com mailto:sales@picnpoke.com