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

技術熱線: 4007-888-234
設計開發

專注差異化嵌入式產品解決方案 給智能產品定制注入靈魂給予生命

開發工具

提供開發工具、應用測試 完善的開發代碼案例庫分享

技術支持

從全面的產品導入到強大技術支援服務 全程貼心伴隨服務,創造無限潛能!

新品推廣

提供新的芯片及解決方案,提升客戶產品競爭力

新聞中心

提供最新的單片機資訊,行業消息以及公司新聞動態

demo2板數碼管從0加1到999999程序

更新時間: 2019-03-23
閱讀量:1798

十年專注單片機方案開發的方案公司英銳恩,分享demo2板數碼管從0加1到999999程序。英銳恩現提供服務產品涉及主控芯片:8位單片機、16位單片機、32位單片機及各類運算放大器等。

;實驗目的:熟悉數碼管的動態顯示
;數碼管顯示數字加1從“0-999999”
;硬件要求:撥碼開關S6全置ON,S5第6位置ON,其它位和撥碼開關置OFF
 #INCLUDE            ;包含頭文件
__CONFIG _DEBUG_OFF&_CP_ALL&_WRT_HALF&_CPD_ON&_LVP_OFF&_BODEN_OFF&_PWRTE_ON&_WDT_OFF&_HS_OSC
;芯片配置字,看門狗關,上電延時開,掉電檢測關,低壓編程關,加密,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

 (文源網絡,侵刪)

联系我们: 德昌县| 五华县| 双辽市| 邵东县| 来宾市| 宁德市| 长兴县| 无锡市| 郓城县| 肇东市| 清徐县| 郑州市| 衢州市| 辽中县| 江都市| 驻马店市| 渭南市| 万州区| 万荣县| 云霄县| 景宁| 永春县| 尉犁县| 无棣县| 普格县| 靖西县| 江陵县| 资溪县| 房山区| 英吉沙县| 大同市| 阜城县| 金乡县| 晋中市| 武清区| 莲花县| 隆尧县| 昌宁县| 金昌市| 彝良县| 钟山县|