PIC microcontroller digital tube program

Publisher:画意人生Latest update time:2015-07-15 Source: 51hei Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
#INCLUDE"P16F877.inc"
   ORG  000H
   GOTO A1
   ORG  0CH
A1 MOVLW 1; bit 1 displays the number
   MOVWF 50H; 
   MOVLW 2; bit 2 displays the number
   MOVWF 51H;
   MOVLW 3; bit 3 displays the number
   MOVWF 52H;
   MOVLW 4; bit 4 displays the number
   MOVWF 53H;
   MOVLW 4; Display digits
   MOVWF 40H;
   MOVLW B'00000001'; bit code
   MOVWF 41H;
   MOVLW 50H;
   MOVWF FSR ; indirect addressing
   
A2 BSF STATUS,RP0;body1
   BCF  STATUS,RP1;
   MOVLW 0;
   MOVWF TRISB; RB port is set as output port
   MOVWF TRISD; RD port is set as output port
   BCF STATUS,RP0;body0
   BCF  STATUS,RP1;
   MOVLW 0FFH;
   MOVWF PORTB; RB port outputs high level
   MOVLW 0
   MOVWF PORTD; RD port outputs low level to clear the screen
   
   MOVFW INDF; indirect addressing display data  
   CALL Q1; check the data table
   MOVWF PORTB; Display the broken code output to port RB
   INCF FSR,1; Indirect addressing address plus 1
   MOVFW 41H ; bit code
   MOVWF PORTD; bit code output to RD port
   RLF 41H,0; Process C
   RLF 41H,1; left shift code
   CALL M001; Delay
   DECFSZ 40H,1; Determine whether the 4 bits are displayed
   GOTO A2; otherwise continue to display
   GOTO A1; is to return
;*********************************************
; Delay subroutine
;*********************************************
M001
   MOVLW 2
   MOVWF 30H
M002  MOVLW 250
   MOVWF 31H
   DECFSZ 31H,1
   GOTO $-1
   DECFSZ 30H, 1
   GOTO M002
   RETURN
;********************************************
; data sheet
;********************************************      
Q1   ADDWF  PCL,1  
    RETLW     00C0H        ;0
       RETLW     00F9H        ;1
        RETLW     00A4H        ;2
        RETLW     00B0H        ;3
      RETLW     0099H        ;4
      RETLW     0092H        ;5
      RETLW     0082H        ;6
      RETLW     00F8H        ;7
      RETLW     0080H        ;8
      RETLW     0090H        ;9
      RETLW     0088H        ;A
      RETLW     0083H        ;B
      RETLW     00C6H        ;C
      RETLW     00A1H        ;D
      RETLW     0086H        ;E
      RETLW     008EH        ;F
   END 
Reference address:PIC microcontroller digital tube program

Previous article:PIC microcontroller flashing program
Next article:PIC microcontroller external interrupt

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号