On Sat, 5 Jun 2010, David Meiklejohn wrote: > > AM/PM for current and alarm time at stored as single bits within a flag > register: > > flags res 1 > constant PM=0 ; time AM (0) / PM (1) > constant STANDBY=1 ; sleep mode (1) > constant DSP_OFF=2 ; display blanked during dimming (1) > constant ALM_ON=3 ; alarm on (1) > constant ALM_PM=4 ; alarm AM (0) / PM (1) > constant ALM_PRS=5 ; debounced ALARM button press (1) > constant FAST=6 ; fast time adjust mode (1) > > > So finally to the point. Does anyone know an elegant way to compare (XOR) > two bits in the same register, using midrange PIC instructions? movf flags,w andlw 0x11 addlw 0x0F ; propergate PM bit to ALM_PM bit and XOR ; the new bit with the old bit (at the ; ALM_PM bit position) andlw 0x10 btfss STATUS,Z ; if w == 0 then PM == ALM_PM goto nomatch match nomatch Regards Sergio Masci -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist