;The two-digit digital tube displays 00--99 in sequence.
org 0000h
a_bit equ 20h; The single digit of the digital tube stores the memory location
b_bit equ 21h; The tens digit of the digital tube stores the memory location
temp equ 22h ;The counter value is stored in the memory location
star: mov temp,#0; initialize counter, starting from 0
stlop: acall display; call display subroutine
inc temp; add 1 to the counter
mov a,temp
cjne a,#100,next ; Determine whether the counter is full of 100?
mov temp,#0; clear it when it reaches 100 and start again
next: ljmp stlop; loop if not satisfied
;display subroutine
display: mov a,temp ;Convert the hexadecimal number in temp to decimal
mov b,#10 ;decimal/10=decimal
div ab
mov b_bit,a ; the tenth bit is in a
mov a_bit,b ;the ones bit is in b
MOV DPTR,#NUMTAB; specifies the starting address of the table lookup
mov r0,#4
dpl1: mov r1,#250;
dplop: mov a,a_bit; take single digit
MOVC A,@A+DPTR; Check single-digit 7-segment code
mov p0,a ;send 7 pieces of code of units digit
clr p2.7; turn on ones digit display
acall d1ms ;display 162 microseconds
setb p2.7; turn off the units display to prevent ghosting
mov a,b_bit ; take ten digits
MOVC A,@A+DPTR; Check 7 code segments with ten digits
mov p0,a ;send 7 pieces of code with ten digits
clr p2.6; Turn on tens digit display
acall d1ms ;display 162 microseconds
setb p2.6; turn off tens digit display to prevent ghosting
djnz r1,dplop; loop executed 250 times
djnz r0,dpl1; loop execution 250X4=1000 times
ret
;2+2X80=162 microseconds, the delay is calculated according to 12MHZ
D1MS: MOV R7,#80
DJNZ R7,$
RET
;The common cathode display code of the 7-segment digital tube from 0 to 9 on the experimental board
NUMTAB:DB 0CFH,03H,5DH,5BH,93H,0DAH,0DEH,43H,0DFH,0DBH
end
Previous article:Single chip microcomputer lighting (lighting, flashing, running light)
Next article:Use the microcontroller AT89C51 to make an 8-way running water lamp
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- 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
- Wi-Fi 8 specification is on the way: 2.4/5/6GHz triple-band operation
- Wi-Fi 8 specification is on the way: 2.4/5/6GHz triple-band operation
- Vietnam's chip packaging and testing business is growing, and supply-side fragmentation is splitting the market
- Vietnam's chip packaging and testing business is growing, and supply-side fragmentation is splitting the market
- Three steps to govern hybrid multicloud environments
- Three steps to govern hybrid multicloud environments
- Microchip Accelerates Real-Time Edge AI Deployment with NVIDIA Holoscan Platform
- Microchip Accelerates Real-Time Edge AI Deployment with NVIDIA Holoscan Platform
- Melexis launches ultra-low power automotive contactless micro-power switch chip
- Melexis launches ultra-low power automotive contactless micro-power switch chip
- 【Gravity:AS7341 Evaluation】+ Frequency Value Detection
- The homemade sensor test board (bone vibration) is finished and ready for production
- RK3288 baseboard + core board design process
- CCS import routine
- Help designing power adapter
- Seek advice from experts in lidar software and hardware
- "Playing with the Board" + Replaying MicroPython on the STM32F7DISC (6)
- Characteristics and application fields of electronic tags in various frequency bands in RFID technology
- The Hummingbird E203RISCV processor uses custom assembly instructions and NICE bus to read and write control ideas for the coprocessor memory
- [Long-term recruitment] Beijing Haidian - Annual salary starting from 600,000 - Embedded software and hardware engineer