Bianry Clock
Sorry, I couldn't get a good scan of my printout, and I can't seem to find my original file. I have included the assembly also.
David
BinaryClock.asm
-------------------------------
time equ 0x30
sec equ 0x31
min equ 0x32
hour equ 0x33
xxx equ 0x34
ooo equ 0x35
cntr equ 0x36
cntr2 equ 0x37
cntr3 equ 0x38
org 0x00
goto start
start CLRF PORTA ; Initialize port A
BSF STATUS,RP0 ; RAM bank 1
movlw 0x08
movwf TRISA ; 3 input
movlw 0x80
movwf TRISB ;7 input
BCF STATUS,RP0 ; RAM bank 0
MOVLW 0x07
MOVWF CMCON
movlw 0x01
movwf sec
addlw 1
movwf min
addlw 1
movwf hour
bcf xxx, 0
bcf xxx, 1
main call set
call show
goto main
set btfsc portb, 7
goto out3
call delay
btfsc portb, 7
goto out3
call delay
incf min, 1
call show
out3 return
show movf min, 0
movwf portb
bsf porta, 1
bcf porta, 1
bsf porta, 1
bcf porta, 1
clrf portb
return
delay movlw 0x08
movwf cntr
delay1 movlw 0x80
movwf cntr2
delay2 movlw 0x80
movwf cntr3
delay3 decfsz cntr3,1
goto delay3
decfsz cntr2,1
goto delay2
decfsz cntr, 1
goto delay1
clrw
return