MCU Secret Manual: Fifteen Dragon Subduing Palms

Publisher:huanliLatest update time:2016-06-20 Source: eefocusKeywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
Learning to use a microcontroller means understanding the microcontroller hardware structure and the application of internal resources, learning how to initialize various functions in assembly or C language, and how to compile programs to implement various functions.

 

Step 1: Use of Digital I/O

By using buttons to input signals and LEDs to display output levels, you can learn the digital I/O functions of pins. After pressing a button, a LED lights up. This is the function of combinational logic in digital circuits. Although it is very simple, you can learn general microcontroller programming ideas. For example, many registers must be set to initialize the pins so that the pins have digital input and output functions. Every time a function of the microcontroller is used, the register that controls the function must be set. This is the characteristic of microcontroller programming. Don't be afraid of trouble. All microcontrollers are like this.

 

Step 2: Use the timer

Once you learn how to use a timer, you can use a single-chip microcomputer to implement a sequential circuit. The function of a sequential circuit is powerful and has many applications in the control of industrial and household electrical equipment. For example, a single-chip microcomputer can be used to implement a corridor light switch with a button. After the button is pressed once, the light will automatically turn off after 3 minutes. When the button is pressed twice in a row, the light will always be on. When the button is pressed for more than 2 seconds, the light will turn off. Digital integrated circuits can implement sequential circuits, programmable logic devices (PLDs) can implement sequential circuits, and programmable controllers (PLCs) can also implement sequential circuits, but only single-chip microcomputers are the simplest to implement and have the lowest cost. The use of timers is very important, and logic plus time control is the basis for the use of single-chip microcomputers.

 

Step 3: Interrupt

The characteristic of a single-chip microcomputer is that a program is repeatedly executed. The execution of each instruction in the program requires a certain execution time. If the program does not execute a certain instruction, the action of the instruction will not occur, which will delay many fast-moving things, such as the falling edge when a button is pressed. In order to make the single-chip microcomputer respond to fast actions during the normal operation of the program, the interrupt function of the single-chip microcomputer must be used. This function is that after the fast action occurs, the single-chip microcomputer interrupts the normal operation of the program, processes the fast action, and returns to execute the normal program after the processing is completed. The difficulty in using the interrupt function is that it is necessary to accurately know when to allow the interrupt to occur (shield the interrupt) and when to allow the interrupt to occur (open the interrupt). Of course, multiple things can also be monitored. Figuratively speaking, the interrupt function enables the single-chip microcomputer to have the function of eating from the bowl and watching the pot. Learning the above three steps is equivalent to the martial arts of the Eighteen Dragon Subduing Palms. If you have learned three palms, you can barely protect yourself.

 

Step 4: RS232 communication with PC

 

The microcontroller has a USART interface, especially many models in the MSP430 series, which have two USART interfaces. The USART interface cannot be directly connected to the RS232 interface of the PC. The logic levels between them are different, and a MAX3232 chip is required for level conversion. The use of the USART interface is very important. Through this interface, information can be exchanged between the microcontroller and the PC. Although RS232 communication is not advanced, it is very important to learn the interface. To use the USART interface correctly, you need to learn the communication protocol, the RS232 interface programming of the PC, and so on. Just imagine that the data on the microcontroller experiment board is displayed on the PC monitor, and the keyboard signal of the PC can be displayed on the microcontroller experiment board. How interesting it will be!

 

Step 5: Learn A/D conversion

The MAP430 microcontroller has a multi-channel 12-bit A/D converter, which can be used to operate analog quantities, display and detect voltage, current and other signals. When learning, pay attention to concepts such as analog ground and digital ground, reference voltage, sampling time, conversion rate, conversion error, etc. A simple example of using the A/D conversion function is to design a voltmeter.

 

Step 6: Learn PCI, I2C interface and LCD interface

The use of these interfaces can make it easier for the microcontroller to connect to external devices, which is very important in expanding the functions of the microcontroller.

 

Step 7: Learn to compare, capture, and PWM functions

These functions enable the microcontroller to control the motor, detect the speed signal, and realize the control functions such as the motor speed regulator.

If you have learned all the above seven steps, you can design a general application system, which is equivalent to learning the ten moves of the Eighteen Dragon Subduing Palms and being able to attack.

 

Step 8: Learn the hardware and software design of USB interface, TCP/IP interface, and various industrial buses

It is very important to learn the hardware and software design of USB interface, TCP/IP interface, and various industrial buses, because this is the current development direction of product development.

So far, it is equivalent to learning 15 moves of the Eighteen Dragon Subduing Palms, but it is not yet the realm of being invincible. Even so, it is still considered a master of single-chip computers.

Keywords:MCU Reference address:MCU Secret Manual: Fifteen Dragon Subduing Palms

Previous article:How to get a higher baud rate with a 6M crystal
Next article:TV backlight 3D infrared signal transmission solution based on MSP430G2303

Recommended ReadingLatest update time:2024-11-16 20:30

NRF24L01 wireless module multi-machine communication MCU program host computer + slave computer
I recently took on a project that required each device to be able to be controlled by networking (not the Internet). nrf24l01 happens to have this function. But I have only done one-to-one communication before, and that was the kind that used routines. I thought that it should be possible to use two addresses and shar
[Microcontroller]
The two major series of microcontrollers are PK_MSP430 and AVR
  There are many types of microcontrollers, and many manufacturers have launched their own MCUs. Among the many brands of microcontrollers, I prefer the MSP430 and AVR series. The following is a PK analysis based on their respective characteristics and several aspects.   Since we are doing a PK, just like a sports c
[Microcontroller]
The two major series of microcontrollers are PK_MSP430 and AVR
Detailed explanation of micro PLC based on AT89C51 single chip microcomputer
Programmable Controller PC (Programmable Controller), to distinguish it from Personal Computer PC (Personal Computer), can be referred to as PLC. It is based on mature and effective relay control concepts and design ideas, using advanced single-chip microcomputer technology to achieve real-time detection and control o
[Microcontroller]
Detailed explanation of micro PLC based on AT89C51 single chip microcomputer
Supplement: 51 MCU learning external interrupt
The day before yesterday, I learned about interrupts and I also did it. I didn't learn it yesterday. Today, I started to try the interrupt query method, but it turned out to be wrong. I looked for information on the Internet, but it was still wrong. It was the same as the timer interrupt. I felt that there shouldn't be
[Microcontroller]
Design of a portable digital storage oscilloscope with single chip microcomputer as the control core
With the development of electronic communication and teaching, the application of oscilloscope is becoming more and more extensive, and its role in teaching is becoming more and more important. Oscilloscope can measure the amplitude, frequency and waveform of the signal, but the high-precision oscilloscope is very exp
[Test Measurement]
Design of a portable digital storage oscilloscope with single chip microcomputer as the control core
Using PIC microcontroller to make a natural wind generator for electric fans
1. Introduction to PIC microcontrollers  PIC16C5X is a low-cost commercial microcontroller with internal program memory (0.5~~2K), working registers (32~~80), 33 streamlined instructions, internal watchdog (WDT), clock/pulse counter RTCC, bidirectional programmable I/O ports (12~~20), and the OTP (one-time programmabl
[Microcontroller]
Using PIC microcontroller to make a natural wind generator for electric fans
51 MCU UART
Serial port related register configuration The registers related to the 51 microcontroller serial port are SBUF, SCON, PCON, and registers related to timer 1 (T1). SBUF: Serial port buffer register. Physically, there are two registers with overlapping addresses. One is used for sending and the other is used for rece
[Microcontroller]
51 MCU UART
The main means to improve the anti-interference ability of single-chip microcomputer system
  1. Grounding   The grounding here refers to the earth, also known as the protective ground. Providing a good ground wire for the microcontroller system is extremely beneficial to improving the system's anti-interference ability. Especially for systems with lightning protection requirements, good grounding is essen
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号