Introduction: A full-duplex UART (Universal Asynchronous Receiver Transmitter) serial I/O port, used to realize serial communication between MCUs or between MCU and microcomputer;
on-chip oscillator and clock generation circuit, quartz crystal and fine-tuning capacitor need to be connected externally. The maximum oscillation frequency depends on the MCU model and performance.
1. The composition of the microcontroller:
CPU: It consists of operation and control logic, as well as an interrupt system and some external special function registers;
RAM: used to store data that can be read and written, such as intermediate results of calculations, final results, and data to be displayed;
ROM: used to store programs, some original data and tables;
I/O port: Four 8-bit parallel I/O ports, which can be used as both input and output;
T/C: Two timers/counters, which can work in both timing mode and counting mode;
Interrupt control system with five interrupt sources;
A full-duplex UART (Universal Asynchronous Receiver Transmitter) serial I/O port for serial communication between MCUs or between MCU and microcomputer;
The oscillator and clock generation circuit are built in, and the quartz crystal and fine-tuning capacitor need to be connected externally. The maximum oscillation frequency depends on the model and performance of the microcontroller.
2. Composition and working principle of I2C serial bus
At first, the light is not on because there is no delay between the write signal and the read signal. Add delay1(100). Note that this time cannot be too short. Then add delay1(1) after the SDA and SCL assignments. There seems to be no time limit here.
3. Composition and working principle of I2C serial bus - debugging of power-off saving display program
1. Now warn that there is a problem with AT24C02, which is caused by the input method problem during programming. At this time, you should pay attention to input in English format. In addition, the position of the digital tube is not displayed correctly
2. The LED display tens digit flickers unsteadily. The problem is alleviated to some extent by adjusting the delay time in the LED program, but the problem still exists. If the value is changed to a very small value, problem 3 will occur;
3. The ten digits have the same afterglow as the ones digits? The problem is solved by modifying the delay time in the main function, but the digits are still flashing.
4. Clock Program
#include <> format: reference the standard library header file, the compiler starts searching from the standard library directory
#incluce "" format: references header files of non-standard libraries, and the compiler starts searching from the user's working directory
1. The seconds displayed on the LCD changes too slowly?
The problem is that the if statement below while is written as if(count==0), which should be if(count==20)
2. The LCD time is incorrect when there is a carry. When the time is set to 23:59:30, it is displayed as 23:59:00. After the second carries, the minute is displayed as 1, and the clock does not carry.
Cause of the problem: The initialization display is unsuccessful, and it starts at 00:00:00 by default;
Solution: Initialization shi=23, fen=59, miao=30 is written in the display sub-function, which should be written in the main function.
5. Clock Program
1. The initial debugging of keyscan() did not work because keyscan() was not written under the large while(1) loop.
2. In keyscan, if(s1num!=0) should be written at the same level as if(s1==0). If it is written inside if(s1==0), it will appear that two keys must be pressed at the same time for a change to occur, which obviously does not meet the requirement, so there is no response.
3. In keyscan, miao.fen,shi should be set to 0 when it is -1, but at the beginning, miao.fen,shi is set to uchar type, so it should be changed to char type.
4. After writing the year-month-day display function, when the date has a carry, a distorted screen occurs at 23;59;59;. It is probably because the address pointer is not set in time after writing the data? It needs to be solved?
The problem lies in the year-month-day function that I wrote, which cannot read the data normally? The data write function was written as a command write function, that is, lcdwrite_date() was written as lcdwrite_date(); after the change, the year, month and day can be displayed, but the year display time is incorrect.
The year is a four-digit number, which cannot be expressed correctly using the uchar type. Instead, the unsigned long type should be used. In the write_nian() function, it should also be noted that the date type should also be an unsigned long type.
6. Perpetual Calendar Clock Program
1. After initialization, the initial debugging of year, month and day is successful.
2. When writing the month and the year separately, there is a debugging problem. The cursor keeps flashing on the seconds position and does not move.
Previous article:Extended memory circuit design
Next article:How to simulate the counting method of serial port in 51 single chip microcomputer
- 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
- CGD and Qorvo to jointly revolutionize motor control solutions
- CGD and Qorvo to jointly revolutionize motor control solutions
- Keysight Technologies FieldFox handheld analyzer with VDI spread spectrum module to achieve millimeter wave analysis function
- Infineon's PASCO2V15 XENSIV PAS CO2 5V Sensor Now Available at Mouser for Accurate CO2 Level Measurement
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- A new chapter in Great Wall Motors R&D: solid-state battery technology leads the future
- Naxin Micro provides full-scenario GaN driver IC solutions
- Interpreting Huawei’s new solid-state battery patent, will it challenge CATL in 2030?
- Are pure electric/plug-in hybrid vehicles going crazy? A Chinese company has launched the world's first -40℃ dischargeable hybrid battery that is not afraid of cold
- MSP430G2553ADC conversion program
- 【Development Kit for nRF52840】+ Hardware Review
- [Repost] Comparison between aluminum electrolytic capacitors and tantalum capacitors
- Tianjin - Recruiting embedded software and hardware engineers - fresh graduates preferred
- CXA-L10A Tube Lamp Inverter
- Transistor User Manual
- Encoders and Data Acquisition
- Analysis of the working principle of PWM in single chip microcomputer
- Please tell me about a very strange problem caused by while(1) in the main.c file.
- How do pressure sensors work at high temperatures?