專注差異化嵌入式產(chǎn)品解決方案 給智能產(chǎn)品定制注入靈魂給予生命
提供開發(fā)工具、應(yīng)用測試 完善的開發(fā)代碼案例庫分享
從全面的產(chǎn)品導(dǎo)入到強大技術(shù)支援服務(wù) 全程貼心伴隨服務(wù),創(chuàng)造無限潛能!
提供新的芯片及解決方案,提升客戶產(chǎn)品競爭力
提供最新的單片機資訊,行業(yè)消息以及公司新聞動態(tài)
十年專注單片機方案開發(fā)的方案公司英銳恩,分享demo2板數(shù)碼管從0加1到999999程序。英銳恩現(xiàn)提供服務(wù)產(chǎn)品涉及主控芯片:8位單片機、16位單片機、32位單片機及各類運算放大器等。
;實驗?zāi)康模菏煜?shù)碼管的動態(tài)顯示
;數(shù)碼管顯示數(shù)字加1從“0-999999”
;硬件要求:撥碼開關(guān)S6全置ON,S5第6位置ON,其它位和撥碼開關(guān)置OFF
#INCLUDE ;包含頭文件
__CONFIG _DEBUG_OFF&_CP_ALL&_WRT_HALF&_CPD_ON&_LVP_OFF&_BODEN_OFF&_PWRTE_ON&_WDT_OFF&_HS_OSC
;芯片配置字,看門狗關(guān),上電延時開,掉電檢測關(guān),低壓編程關(guān),加密,4M晶體HS振蕩
TMRO equ 01H
status equ 03h
pcl equ 02h
TRISA equ 85H
TRISD equ 88h
count equ 20h
count1 equ 27h
number equ 28h
w_temp equ 21h
s_temp equ 22h
tmro_b equ 23h
count2 equ 29h
count3 equ 30h
count4 equ 31h
count5 equ 32h
org 00h
nnnnn
nop
goto main
org 004h
tmroserv
movwf w_temp
swapf STATUS,W
CLRF STATUS
MOVWF s_temp
incf count
movlw .10
xorwf count,w
bz lp1
goto lp7
lp1
clrf count
incf count1
movlw .10
xorwf count1,w
bz lp2
goto lp7
lp2
clrf count
clrf count1
incf count2
movlw .10
xorwf count2,w
bz lp3
goto lp7
lp3
clrf count
clrf count1
clrf count2
incf count3
movlw .10
xorwf count3,w
bz lp4
goto lp7
lp4
clrf count
clrf count1
clrf count2
clrf count3
incf count4
movlw .10
xorwf count4,w
bz lp5
goto lp7
lp5
clrf count
clrf count1
clrf count2
clrf count3
clrf count4
incf count5
movlw .10
xorwf count5,w
bz lp6
goto lp7
lp6
clrf count
clrf count1
clrf count2
clrf count3
clrf count4
clrf count5
lp7
bcf STATUS,2
movlw tmro_b
movwf TMR0
MOVLW 0A0H
MOVWF INTCON
BCF INTCON,2
swapf s_temp,w
movwf STATUS
MOVFW w_temp
retfie
main
bcf STATUS,5
MOVLW 0a0h
MOVWF INTCON
BCF INTCON,2
movlw tmro_b
movwf TMRO
MOVLW 0FFH
MOVWF PORTA
MOVWF PORTD
bsf STATUS,5
CLRF TRISA
CLRF TRISD
movlw 06H
movwf ADCON1
movlw 07H
movwf OPTION_REG
bcf STATUS,5
clrf number
CLRF count
CLRF count1
clrf count2
clrf count3
clrf count4
clrf count5
LOOP
movfw count
call TABLE
MOVWF PORTD
BCF PORTA,5
CALL delay
bsf PORTA,5
MOVFW count1
call TABLE
MOVWF PORTD
BCF PORTA,4
CALL delay
BSF PORTA,4
MOVFW count2
call TABLE
MOVWF PORTD
BCF PORTA,3
CALL delay
BSF PORTA,3
MOVFW count3
call TABLE
MOVWF PORTD
BCF PORTA,2
CALL delay
BSF PORTA,2
MOVFW count4
call TABLE
MOVWF PORTD
BCF PORTA,1
CALL delay
BSF PORTA,1
MOVFW count5
call TABLE
MOVWF PORTD
BCF PORTA,0
CALL delay
BSF PORTA,0
goto LOOP
;-----------------------
delay
;MOVLW 03H ;0.6S
;MOVWF 24H
;LP0 ;0.2S廷時子程序
MOVLW D'50'
MOVWF 25H
LP1
MOVLW D'16'
MOVWF 26H
LP2
DECFSZ 26H,1
GOTO LP2
DECFSZ 25H,1
GOTO LP1
;DECFSZ 24H,1
;GOTO LP0
RETURN
;-----------------------
TABLE
ADDWF pcl,1
retlw 0c0h ;0
retlw 0f9h ;1
retlw 0a4h ;2
retlw 0b0h ;3
retlw 99h ;4
retlw 92h ;5
retlw 82h ;6
retlw 0F8h ;7
retlw 80h ;8
retlw 90h ;9
;-----------------------
end
(文源網(wǎng)絡(luò),侵刪)