As shown in Figure
4.13.1, the P0 port is connected to the character code pen segment of the dynamic digital tube, the P2 port is connected to the digit selection end of the dynamic digital tube, and P1.7 is connected to a switch. When the switch is connected to a high level, "12345" is displayed; when the switch is connected to a low level, "HELLO" is displayed.
2.
Circuit diagram
Figure
4.13.1
3.
Hardware connection on the system board
(1. Connect P0.0/AD0 - P0.7/AD7 in the "MCU System" area to ports a - h in the "Dynamic Digital Display" area using an 8- core cable ;
(2.
Connect
P2.0/A8
-
P2.7/A15
in the "MCU System" area
to the
S1
-
S8
ports
in the "Dynamic Digital Display" area
using
an
8-
core cable
;
(3.
Connect the
P1.7
port
in the "MCU System" area
to the
SP1
port
in the "Standalone Keyboard" area with a wire
;
4.
Programming content
(1.
Dynamic scanning method
The dynamic interface uses a method in which each digital tube is displayed in turn in a cycle. When the frequency of the cyclic display is high, the flickering display phenomenon cannot be seen by utilizing the retention characteristics of the human eye. This display requires one interface to complete the output of the glyph code (glyph selection) and another interface to complete the lighting of each digital tube in turn (digit selection).
(2.
When performing digital display,
8
display buffers should be opened for the display unit, and each display buffer is loaded with different display data.
(3.
For the displayed glyph code data, we use the table lookup method to complete it.
5. Flowchart
Figure
4.13.2
6.
Assembly source program
ORG 00H
START:
JB P1.7,DIR1
MOV DPTR,#TABLE1
SJMP DIR
DIR1:
MOV DPTR,#TABLE2
DIR:
MOV R0,#00H
MOV R1,#01H
NEXT:
MOV A,R0
MOVC A,@A+DPTR
MOV P0,A
MOV A,R1
MOV P2,A
LCALL DAY
INC R0
RL A
MOV R1,A
CJNE R1,#0DFH,NEXT
SJMP START
DAY:
MOV R6,#4
D1:
MOV R7,#248
DJNZ R7,$
DJNZ R6,D1
RET
TABLE1:
DB 06H,5BH,4FH,66H,6DH
TABLE2:
DB 78H,79H,38H,38H,3FH
END
7.
C language source program
#include
unsigned char code table1[]={0x06,0x5b,0x4f,0x66,0x6d};
unsigned char code table2[]={0x78,0x79,0x38,0x38,0x3f};
unsigned char i;
unsigned char a,b;
unsigned char temp;
void main(void)
{
while(1)
{
temp=0xfe;
for(i=0;i<5;i++)
{
if(P1_7==1)
{
P0=table1[i];
}
else
{
P0=table2[i];
}
P2=temp;
a=temp<<(i+1);
b=temp>>(7-i);
temp=a|b;
for(a=4;a>0;a--)
for(b=248;b>0;b--);
}
}
}
Previous article:4×4 matrix keyboard recognition technology
Next article:Ding Dong doorbell
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Will wireless connection bring major changes to our lives?
- What are the mainstream embedded operating systems?
- Does anyone know what chip or solution can be used for TSN?
- [NUCLEO-WL55JC2 Review] + Simple Unboxing
- How to layout PCB design?
- How much effort does life take?
- Speedy driving test system OBD serial port data host computer DEMO + source code
- [Erha Image Recognition Artificial Intelligence Vision Sensor] 4. Use the object classification function to perform insulator classification test
- Help: AD5422AREZ-REEL REFOUT pin output voltage is abnormal
- Operational amplifier circuit