Microcontrollers MCU is an integrated circuit chip. It uses large-scale integrated circuit technology to integrate the central processing unit CPU with data processing capabilities, random access memory RAM, read-only memory ROM, multiple I/O ports and interrupt systems, timer/counter and other functions (may also include display drive circuit, pulse width modulation circuit, analog multiplexer, A/D converter and other circuits) on a silicon chip to form a small and complete microcomputer system. It is widely used in the field of industrial control. Since the 1980s, it has developed from the 4-bit and 8-bit microcontrollers at that time to the current 300M high-speed microcontrollers.
These are found on Baidu
Simply put, it is a micro and cheap logic circuit to control many electrical things around us.
A single chip is a single silicon chip embedded in other systems, which is a simple and low-level embedded system. Embedded refers to embedded products. In a narrow sense, it is embedded in Linux systems such as Android phones.
The blogger is majoring in automation, so microcontrollers are very important. Since I am only a freshman now, I will start with the simple 51 and then further study arm. Embedded systems are also a good direction in the future, so I will record my learning process and welcome everyone to study with me.
The first step is to install the environment keil c51
Link: https://pan.baidu.com/s/1B-gWsxK2wiFtWQe5I4AUAA
Extraction code: 8pro
When activating, you need to run it as an administrator and then perform the activation instructions. There are
(Remember to wear headphones to activate some sexy music)
Install the download tool (download the program to the single-sided machine, this depends on the microcontroller you use, here is stc)
Link: https://pan.baidu.com/s/1vELF1DiPe3eykRs8HbWQYA
Extraction code: 9pe4
The 51 microcontroller was developed by Intel a long time ago and its core was open to the public, so anyone can see it.
Also, you need to install the USB to serial port driver, which can be automatically installed by the driver master.
Link: https://pan.baidu.com/s/120E1RS-UD47PJLlO_SMb6A
Extraction code: f0ci
If you can see this in the device manager, it means it is installed, but it may not be COM4. It may be any COM.
MCU Timer
1. The meaning of CPU is like the alarm clock to people
Because the CPU can only do one thing at a time, it is necessary to set a time to end and start tasks.
2. Use the interrupt mechanism software and hardware agreement to let the CPU execute a specific program function that interrupts the program after a period of time.
3. There can be multiple timers that can work simultaneously. 51 is two 8-bit long time can be 16-bit short time can be 8-bit
4. Using the counter principle, the 51 single-chip microcomputer uses the addition timer overflow and then interrupts. Similar to data overflow, there is also a subtraction timer that decrements from the initial value.
5. Timing initial values THn and TLn
The microcontroller wizard can input time, calculate initial time value and many other functions
Link: https://pan.baidu.com/s/1tWZo-ByP8J1TMj07gQ6miw
Extraction code: z03r
See the development manual for specific usage
void main(void)
{
Timer0Init(); //Timer initialization
while (1); //At this time, the CPU main task is 1 infinite loop
}
void Timer0Init(void)
{
TMOD &= 0xf0; // T0 is set to timer mode, only TR0 is used to control opening
TMOD |= 0x01; // T0 is selected as working mode 1: 16-bit timer, TH0 TL0 are fully used
TH0 = 0xd8; // Use the MCU Elf to calculate the initial values of TH0 and TL0 for 10ms timing
TL0 = 0xf0;
ET0 = 1; // Enable timer 0 interrupt
EA = 1; // Enable general interrupt
TR0 = 1; // Start timing
}
void Timer0Isr(void) interrupt 1 //1 represents T0 timer
{
TH0 = 0xd8; // Use the MCU Elf to calculate the initial values of TH0 and TL0 for 10ms timing
TL0 = 0xf0;
if (gCnt++ >= 50) // Every 50*10ms = 500ms, the LED will switch on and off
{
gCnt = 0; // Set gCnt to the initial value 0 to start the next interrupt count
gLed1 = !gLed1; // LED on and off conversion! It is logic inversion
}
}
Tips: Give an initial value every time
Experimental phenomenon: Flashes every 500ms
How to make the microcontroller run the program you wrote? You need to use the burning software to select the correct signal and serial port number, then open the program file and click download. After the words "detecting the target microcontroller" appear, turn on the microcontroller switch.
This is probably because the microcontroller memory cannot be modified when powered on.
Previous article:51 MCU 8*8 dot matrix snake
Next article:51 single chip microcomputer, dot matrix display Chinese characters (C language)
- 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
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
- Brief Analysis of Automotive Ethernet Test Content and Test Methods
- How haptic technology can enhance driving safety
- Let’s talk about the “Three Musketeers” of radar in autonomous driving
- Why software-defined vehicles transform cars from tools into living spaces
- How Lucid is overtaking Tesla with smaller motors
- Wi-Fi 8 specification is on the way: 2.4/5/6GHz triple-band operation
- The DAC output of the MCU is passed through the DAC0832
- MSP430 driver function for LCD1602
- With vias in vogue, where will high-speed DDR4 signals go?
- Micropython can be simulated in proteus
- EEWORLD University Hall----Live Replay: Introduction of ON Semiconductor's Photovoltaic and Energy Storage Products
- Watch the video to win a JD card | Taixiang test of Shuige cheats
- The motor coil is an inductive load, so the current in the coil will have a certain delay relative to the load voltage on the coil.
- [NXP Rapid IoT Review] +6. Guide to Translation Display Elements
- MicroPython driver porting for STTS751
- Please recommend a PAL video signal equalization chip or amplifier chip