Hi, I mentioned here a while back that I was going to make a clock, and now it's almost finished. It's based on a 16F690, and works great so far. I'm just completing the alarm functionality. The alarm needs to sound when the current time matches the alarm time, and these are stored as: ; current time: secs res 1 ; seconds mins res 1 ; minutes (BCD) hrs res 1 ; hours (BCD) ; alarm time: alm_mins res 1 ; minutes (BCD) alm_hrs res 1 ; hours (BCD) 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) Most of the code sits within (or is called by) a timer ISR running every 1 ms, which multiplexes the display and reads and responds to buttons. Within that timer ISR, the following routine tests for and sounds the alarm (a piezo speaker): alarm ; Sound alarm if set and current time = alarm time btfss flags,ALM_ON ; skip time test if alarm is off goto alm_end banksel mins ; if min = alm_mins movf mins,w xorwf alm_mins,w btfss STATUS,Z goto alm_end movf hrs,w ; and hrs = alm_hrs xorwf alm_hrs,w btfss STATUS,Z goto alm_end banksel TMR1H ; sound alarm by beeping every other second btfsc TMR1H,6 ; TMR0<6> cycles at 1 Hz goto alm_end ; so if TMR0<6> = 0 movlw 1<