list p=16f627a #include p16f627a.inc ; Set config bits ; __CONFIG _INTRC_OSC_NOCLKOUT & _PWRTE_OFF & _WDT_OFF & _CP_OFF & _MCLRE_OFF & _LVP_OFF ; __CONFIG _INTOSC_OSC_NOCLKOUT & _PWRTE_OFF & _WDT_OFF & _CP_OFF & _MCLRE_OFF & _LVP_OFF __CONFIG _XT_OSC & _PWRTE_OFF & _WDT_OFF & _CP_OFF & _MCLRE_OFF & _LVP_OFF ; __CONFIG _LP_OSC & _PWRTE_OFF & _WDT_OFF & _CP_OFF & _MCLRE_OFF & _LVP_OFF __IDLOCS 0xbc11 ; Declare the variables. cblock 0x20 dark ; Time until the display is blanked. ; (Blanking the display saves battery life.) row ; Row to refresh on display ticks ; Ticks this second (0-124) seconds ; Seconds this minute (0-59) minutes ; Minutes this hour (0-59) hours ; Hours this day (0-23) days ; Day of month (1-31) months ; Month of year (1-12) mode ; Current operatin mode ; 0 - displaying time ; 1 - setting minutes ; 2 - setting hours ; 3 - setting days ; 4 - setting months ; Start in mode 4. Pressing the button decrements the mode. ; Pressing the button generally decrements the mode, bouncing ; Non-zero during debounce intervals savew ; Saves W during interrupts saves ; Saves STATUS during interrupts timevh ; Value for the timer register, high byte timevl ; Value for the timer register, low byte ticksec ; Ticks per second (after row division) endc org 0x0000 ;Reset vector goto main ; Jump to main code defined in Example.asm nop ; Pad out so interrupt nop ; service routine gets nop ; put at address 0x0004. goto service ; Points to interrupt service routine org 0x0020 ; Begin program main ; Main code entry -- once only initialization ;OPTION ; Clear RBPU ; Clear TOCS bcf STATUS, RP1 ; Select BANK0 or BANK1 clrwdt errorlevel -302 bsf STATUS, RP0 ; Select BANK1 clrf OPTION_REG errorlevel +302 ;INTCON ; Set GIE ; Set PEIE -- apparently timer 1 is a peripheral? bcf STATUS, RP0 ; Select BANK0 movlw (1<>8) & 0xFF de TimeVal & 0xFF de d'125' ; Configure the clock rate end