#INCLUDE"P16F877.inc"
ORG 000H
GOTO A1
ORG 004H; timing interrupt entry address
GOTO ZD01;
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
BSF STATUS, RP0; select body 1
BCF STATUS,RP1;
MOVLW 00H; 1:2TMRO ratio
MOVWF OPTION_REG; divide by 1/2
BCF STATUS,RP0;body0
BCF STATUS,RP1;
MOVLW 0FFH;
MOVFW TMR0; initial value
BCF INTCON, T0IF; clear the timing interrupt flag
BSF INTCON, T0IE; open timer interrupt
BSF INTCON, GIE; open general interrupt
GOTO $
ZD01 BCF INTCON, GIE; turn off total interrupt
BTFSS INTCON, T0IF; Determine whether a timing interrupt occurs
GOTO ZD03; No, jump out, continue to execute
BCF INTCON,T0IF
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
DECFSZ 40H,1; Determine whether the 4 bits are displayed
GOTO ZD02; otherwise continue to display
MOVLW 4; Display digits
MOVWF 40H;
MOVLW B'00000001'; bit code
MOVWF 41H;
MOVLW 50H;
MOVWF FSR ; indirect addressing
ZD02 MOVLW 0FFH;
MOVFW TMR0; reload initial value
ZD03 BSF INTCON, GIE; open general interrupt
RETFIE ;Interrupt 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
Previous article:PIC microcontroller running light program
Next article:PIC microcontroller interrupt nesting
- Popular Resources
- Popular amplifiers
Recommended Content
Latest Microcontroller Articles
He Limin Column
Microcontroller and Embedded Systems Bible
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
MoreSelected Circuit Diagrams
MorePopular Articles
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
MoreDaily News
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- Learn ARM development(15)
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
Guess you like
- GT911 touch screen chip datasheet
- MCU reset types and faults
- Here's a wave of benefits for everyone. Pay 10 yuan for postage and get a brand new power meter that can measure the power consumption of home appliances. While stocks last.
- Qorvo's customizable PMIC simplifies power management system design
- Can the digital tube screen be driven by the same driving method as the segment code LCD screen?
- Creative digital electronic clock using ESP8266
- Hardware Engineer (Shanghai)
- Three Clouds
- MSP430FR5969 Development Data
- Working principle, circuit analysis and industry status of RF chips