大香蕉大香蕉在线播放-日韩av在线一区中文字幕-日韩熟女熟妇久久精品综合-精品免费视频一区二区三区

技術熱線: 4007-888-234

技術支持

PIC16C54四位LED時鐘顯示程序

更新時間: 2019-03-22

單片機方案開發(fā)的深圳英銳恩PIC16C54四位LED時鐘顯示程序。

title"clock"
list p=16c54,n=66
PIC54 equ 1ffh
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;written by:PIC單片機 ;;
;;四位LED時鐘顯示程序 ;;
;;RB1-SW1秒設置 RB2-SW2分設置 RB3-SW3時設置 ;;
;;RB1--RB7接LED段碼,RA0--RA3做選通 ;;
;;使用4M晶振TMR0滪分頻為1:16 TMRO的循環(huán)時間為4.096MS 244次為一秒 ;;
;;用sec_nth計數(shù) ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
pointer equ 00h
rtcc equ 01h
pc equ 02h
status equ 03h
fsr equ 04h
port_a equ 05h
port_b equ 06h
;---------------------------------

carry equ 0
c equ 0
dcarry equ 1
dc equ 1
z_bit equ 2
z equ 2
p_down equ 3
pd equ 3
t_out equ 4
to equ 4
pa0 equ 5
pa1 equ 6
pa2 equ 7
;---------------------------------
zero equ 0x7e
one equ 0x0c
two equ 0xb6
three equ 0x9e
four equ 0xcc
five equ 0xda
six equ 0xfa
seven equ 0x0e
eight equ 0xfe

nine equ 0xce
colon equ 0x01
t equ 0xf0
blank equ 0x00
;-----------------------------------------
maxnths equ 0x0c ; d12
maxsecs equ 0xc4 ; d196
maxmins equ 0xc4 ; d196
maxhrs equ 0xf4 ; d244
minhrs equ 0xf3 ; d243
adjmin equ 0x09 ; d9
adjhr equ 0x22 ; d34
adjday equ 0x03 ; d3
;-----------------------------------------------
disp1 equ b'11111110' ;pa0--pa3
disp2 equ b'11111101'
disp3 equ b'11111011'
disp4 equ b'11110111'
dispoff equ b'11111111'
switch equ b'00001110' ;key in portb
;---------------------------------------------
sec equ 00h ;秒 flags d0--d7
min equ 01h ;分
hrs equ 02h ;時
chg equ 03h ;有顯示或按鍵按下

sw1 equ 04h ;
sw2 equ 05h ;
sw3 equ 06h ;
sw_on equ 07h ;有鍵按下
;------------------------------------
keys equ 08h ;哪個鍵按下?
flags equ 09h ;the bits for :sec d0. min d1 .hrs d2.chg ;d3.sw1.sw2.sw3 d6 .swon d7
display equ 0bh ;new display
digit1 equ 0ch ;a0
digit2 equ 0dh ;a1
digit3 equ 0eh ;a2
digit4 equ 0fh ;a3 led
;---------------------------------------
sec_nth equ 10h ;秒計數(shù)單元
seconds equ 11h ;秒
minutes equ 12h ;分
hours equ 13h ;時
var equ 14h ;運算變量

count equ 15h
count1 equ 16h

start
movlw 0x03
option
movlw 0
tris port_a
tris port_b
movlw blank
movwf port_b
bcf status,pa1
bcf status,pa0
;----------------------------------------
movlw 0x01
movwf rtcc
movlw 0xfe
movwf display
movlw blank
movwf digit1
movwf digit2
movwf digit3
movwf digit4
movlw maxnths ;d12
movwf sec_nth
movlw maxsecs ;d196
movwf seconds
movlw maxmins
movwf minutes
movlw 0xff
movwf hours
movlw 00h

movwf flags
main
rtcc_fill
movf rtcc,0
btfss status,z
goto rtcc_fill
incfsz sec_nth,1
goto time_done
movlw maxnths
movwf sec_nth
check_sw
btfss flags,sw_on

goto set_time
btfsc flags,sw1
goto set_time
movlw maxsecs ;d196
movwf seconds
movlw 0x7f
movwf sec_nth
btfss flags,sw2
goto hourset
movlw 0xaf
movwf sec_nth
incfsz minutes,1
goto hourset
movlw maxmins ;d196
movwf minutes
hourset
btfsc flags,sw2
goto check_time
incfsz hours,1
goto check_time
movlw maxhrs
movwf hours
goto check_time
set_time
bsf flags,sec

bsf flags,chg
incfsz seconds,1
goto time_done
movlw maxsecs
movwf seconds
bsf flags,min
bsf flags,chg
movlw adjmin
subwf sec_nth,1
incfsz minutes,1
goto time_done
movlw maxmins ;0xc4
movwf minutes
bsf flags,hrs
bsf flags,chg
movlw adjhr ;0x22
addwf sec_nth
incfsz hours,1
goto time_done

movlw maxhrs ;0xf4
movwf hours
movlw adjday ;0x03
subwf sec_nth,1
time_done
btfss flags,chg
goto cycle
check_seconds
btfss flags,sw1
goto check_time
movlw 0x00
movwf digit2
movwf digit3
movwf digit4
movlw maxsecs ;0xc4
subwf seconds,0
movwf digit1
goto split_hex
check_time
movlw 0x00
movwf digit2
movwf digit4
movlw minhrs ;0xf3
subwf hours,0
movwf digit3

movlw maxmins ;0xc4
subwf minutes,0
movwf digit1
split_hex
movlw 0x02
movwf count
movlw digit1
movwf fsr
goto loop
loop2
movlw digit3
movwf fsr
loop movlw 0x0a
subwf pointer,1
btfsc status,c
goto increment_10s
addwf pointer,1
goto next_digit
increment_10s

incf fsr,1
incf pointer,1
decf fsr,1
goto loop
next_digit
decfsz count,1
goto loop2
convert_hex_to_display
movlw digit1
movwf fsr
movlw 0x04
movwf count
next_hex
movf pointer,0
call return_code
movwf pointer
incf fsr,1
decfsz count,1
goto next_hex
fix_display
movlw zero
subwf digit4,0
btfss status,z
goto fix_sec

movlw blank
movwf digit4
fix_sec
btfss flags,sw1
goto clear_flags
movwf digit3
clear_flags
movlw 0xf0
andwf flags,1
cycle
movlw dispoff
movwf port_a
movlw switch
tris port_b
movlw 0x0f
andwf flags,1
nop
nop
nop

movf port_b,0
movwf var
btfss var,1
goto switch2
bsf flags,chg
bsf flags,sw1
bsf flags,sw_on
switch2
btfss var,2
goto switch3
bsf flags,chg
bsf flags,sw2
bsf flags,sw_on

switch3
btfss var,3
goto switch3
bsf flags,chg
bsf flags,sw3
bsf flags,sw_on
setport
movlw 0x00
tris port_b
movlw blank
movwf port_b
btfss display,0
movf digit4,0
btfss display,1
movf digit3,0
btfss display,2
movf digit2,0
btfss display,3
movf digit1,0
movwf port_b
btfsc sec_nth,7
bsf port_b,0
movf display,0
movwf port_a
movwf display
rlf display,1
bsf display,0
btfss display,4

bcf display,0
goto main
return_code
addwf pc,1
retlw zero ;0
retlw one
retlw two
retlw three
retlw four ;4

retlw five
retlw six
retlw seven
retlw eight
retlw nine ;9
org PIC54
goto start


end

404
返回首頁 |  返回上一頁
影音先锋天堂网亚洲无码| 老太太在丛林日老B| 日本二区在线观看| 黄色录像片操大逼的| 白色紧身裤无码系列在线| 内射白嫩少妇超碰| 中文字幕欧美人妻在线| 美女操逼视频app| 美女骚逼黄色18禁| 老司机精品成人无码AV| 精品精品国产一区二区性色av| 男人草女人的骚逼逼| 久久99国产中文| 日韩国产精品视频一区| 骚逼毛茸茸乱伦视频| 免费看澡美女逼视频看看| 找个日韩操逼的看看| 日本高清一区二区三区在线观看| 人人超级碰青青精品| 大肌巴日小个子女人视频| 一级毛片完整版免费播放一区| 国产精品自在自线。| 麻豆视频一级片在线观看| 天天干天天操天天插| 一色道久久88加勒比一| 日韩有码一区二区三区在线观看| 精品一区二区久久久久无码| 男的日女生批网页| 国产裸模大尺度私拍视频| 久久99热东京热亲亲热| 大黑鸡巴操模特骚B| 添女人荫道口视频| 男生用鸡巴操女生的视频| 国产精品久久久久妇| 一级特黄大片色欧美精品| 成年人的一级黄色带| 大鸡巴插美女小逼逼| 波多野结衣浴尿解禁在线| 日本人妻与家公的伦理片| 97超视频免费在线观看| 神马我不卡手机在线观看|