Implementation process
74HC138 decoder (38 decoder) -> 74HC02 NOR gate -> 74HC573 latch
38 decoder
Three inputs control eight mutually exclusive low-effective outputs (three P2 ports control eight Y ports, controlling Y4 to output a low level)
74HC02 NOR Gate
After Y4 outputs a low level, it passes through the NOR gate. At this time, WR is a low level (using the I/O expansion method), and Y4C inputs a high level, that is, LE is a high level (equivalent to making the latch work). Only then can the LED light up. As for the encoding form of the P0 port, I will not write it (this is very simple)
74HC573 Latch
OE: Output Enable
LE: Latch Enable
(I haven't learned these two yet, so it won't affect my study)
Come to update,
D is the input terminal and Q is the output terminal
Note that there is a horizontal bar on OE, which means that the low level is valid (that is, the circuit will work only when the level is low), so OE is connected to the GND terminal
When Y4C inputs a high level, that is, LE is a high level, the state of the Q terminal is determined by the state of the D terminal; when LE is a low level, at this time, no matter what state D is, Q maintains the previous data state.
as the picture shows:
74HC573 Latch
74HC138 decoder (38 decoder) and 74HC02 NOR gate
Different pin connections of J5, J2, and J13 jumper caps (I will update the pin connections later when I learn more)
Jumper cap connection method (connection method of this program): J5 connects to KBD terminal J13 connects to I/O port J2 connects to 2-4 1-3 terminal
code show as below:
#include //sbit HC138_C=P2^7; //sbit HC138_B=P2^6; //sbit HC138_A=P2^5; void Delay(unsigned int t){//delay function while(t--); while(t--); } void LEDrunning() //The LED light flashes three times, then runs in the form of a running light, and repeats the above operation continuously { unsigned char i; // HC138_C=1; //HC138_B=0; // HC138_A=0; //The commented code has the same effect as the code for opening and closing registers P2 = (P2&0x1F|0x80); //Open register for(i=0;i<3;i++) { P0=0x00; //LED lights fully on Delay(60000); Delay(60000); P0=0xff; //LED lights are all off Delay(60000); Delay(60000); } //The following two for loops form the LED light water light form for(i=1;i<=8;i++){ P0=0xff< Delay(60000); Delay(60000); } for(i=1;i<=8;i++){ P0= ~(0xff< Delay(60000); Delay(60000); } P2 &= 0x1F; //Close register } void cls_buzz(void) //Turn off the buzzer { P2 = (P2&0x1F|0xA0); P0 = 0x00; P2 &= 0x1F; } void main() { cls_buzz(); while(1){ LEDrunning(); } } This is basically how you control the display of LED lights. I will update this later when I learn more. Come to update, Turn off peripherals void cls_buzz(void) //Turn off the buzzer { P2 = (P2&0x1F|0xA0); P0 = 0x00; P2 &= 0x1F; } P2 = (P2&0x1F|0xA0); 0x1F is written as 0001 1111 in binary. The default state of P2 port is 1111 1111. P2&0x1f is to clear the upper three bits to 0, because we only need to control the three ports P7-5 in the current register. 0xA0 is 1010 0000. This code is to make Y5 low level, and make Y5C input high level through the NOR gate to control the Y5C latch (as shown in the figure) P0 = 0x00; ULN2003, equivalent to a NOT gate, turns off the buzzer and relay (see the buzzer and relay in this column for details) P2 &= 0x1F; Close, the use of this register ends Open the register to use the LED P2 = (P2&0x1F|0x80); //Open register This is to open the Y4C latch P2 &= 0x1F; //Close register Close the Y4C latch
Previous article:51 MCU Introduction - Buzzer and Relay
Next article:Introduction to 51 MCU - UART serial communication
Recommended ReadingLatest update time:2024-11-16 19:43
- Popular Resources
- Popular amplifiers
- Wireless Sensor Network Technology and Applications (Edited by Mou Si, Yin Hong, and Su Xing)
- Modern Electronic Technology Training Course (Edited by Yao Youfeng)
- Modern arc welding power supply and its control
- Small AC Servo Motor Control Circuit Design (by Masaru Ishijima; translated by Xue Liang and Zhu Jianjun, by Masaru Ishijima, Xue Liang, and Zhu Jianjun)
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
- CC3235S and CC3235SF SimpleLink Wi-Fi dual-band single-chip solutions
- Design of ESD protection structure for CMOS circuits
- 8 Common Uses of Diodes
- TMS320C6655 Fixed and Floating Point Digital Signal Processor
- [Digi-Key KOL Lecture] Common Techniques for Designing Low-Power DC-DC Converters
- Problems encountered in B-U585I-IOT02A test
- [FS-IR02 + D1CS-D54] - 4: Linking with MCU (FS-IR02)
- [Atria Development Board AT32F421 Review] TEST06 CFFT related tests
- EasyARM-RT1052 Review] + Basic IoT transmission framework (final post)
- TCP/IP Detailed Explanation (Layer 7/Layer 4 Protocol)