天堂草原最受欢迎的角色,天堂动漫,天堂在线,色天堂下载,天堂中文在线资源,亚洲男人天堂

技術(shù)熱線: 4007-888-234
設(shè)計(jì)開(kāi)發(fā)

專(zhuān)注差異化嵌入式產(chǎn)品解決方案 給智能產(chǎn)品定制注入靈魂給予生命

開(kāi)發(fā)工具

提供開(kāi)發(fā)工具、應(yīng)用測(cè)試 完善的開(kāi)發(fā)代碼案例庫(kù)分享

技術(shù)支持

從全面的產(chǎn)品導(dǎo)入到強(qiáng)大技術(shù)支援服務(wù) 全程貼心伴隨服務(wù),創(chuàng)造無(wú)限潛能!

新品推廣

提供新的芯片及解決方案,提升客戶(hù)產(chǎn)品競(jìng)爭(zhēng)力

新聞中心

提供最新的單片機(jī)資訊,行業(yè)消息以及公司新聞動(dòng)態(tài)

demo2板數(shù)碼管從0加1到999999程序

更新時(shí)間: 2019-03-23
閱讀量:1795

十年專(zhuān)注單片機(jī)方案開(kāi)發(fā)的方案公司英銳恩,分享demo2板數(shù)碼管從0加1到999999程序。英銳恩現(xiàn)提供服務(wù)產(chǎn)品涉及主控芯片:8位單片機(jī)、16位單片機(jī)、32位單片機(jī)及各類(lèi)運(yùn)算放大器等。

;實(shí)驗(yàn)?zāi)康模菏煜?shù)碼管的動(dòng)態(tài)顯示
;數(shù)碼管顯示數(shù)字加1從“0-999999”
;硬件要求:撥碼開(kāi)關(guān)S6全置ON,S5第6位置ON,其它位和撥碼開(kāi)關(guān)置OFF
 #INCLUDE            ;包含頭文件
__CONFIG _DEBUG_OFF&_CP_ALL&_WRT_HALF&_CPD_ON&_LVP_OFF&_BODEN_OFF&_PWRTE_ON&_WDT_OFF&_HS_OSC
;芯片配置字,看門(mén)狗關(guān),上電延時(shí)開(kāi),掉電檢測(cè)關(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廷時(shí)子程序
  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ò),侵刪)

联系我们: 绍兴市| 青海省| 平南县| 肥西县| 棋牌| 外汇| 罗定市| 和顺县| 大洼县| 怀宁县| 延长县| 宾川县| 镇宁| 桂平市| 沙洋县| 贵港市| 郯城县| 驻马店市| 资兴市| 乌兰浩特市| 中宁县| 龙州县| 金川县| 泽州县| 兴文县| 宜宾县| 甘德县| 南昌县| 运城市| 陇西县| 腾冲县| 克拉玛依市| 水富县| 黄浦区| 南开区| 寿宁县| 高唐县| 茌平县| 沛县| 车致| 内江市|