MindMap Gallery MCU mind map
This is a mind map about microcontrollers, including STC microcontroller architecture, timers/counters, serial, etc. Interested friends are welcome to follow and collect!
Edited at 2023-11-06 11:51:40This is a mind map about bacteria, and its main contents include: overview, morphology, types, structure, reproduction, distribution, application, and expansion. The summary is comprehensive and meticulous, suitable as review materials.
This is a mind map about plant asexual reproduction, and its main contents include: concept, spore reproduction, vegetative reproduction, tissue culture, and buds. The summary is comprehensive and meticulous, suitable as review materials.
This is a mind map about the reproductive development of animals, and its main contents include: insects, frogs, birds, sexual reproduction, and asexual reproduction. The summary is comprehensive and meticulous, suitable as review materials.
This is a mind map about bacteria, and its main contents include: overview, morphology, types, structure, reproduction, distribution, application, and expansion. The summary is comprehensive and meticulous, suitable as review materials.
This is a mind map about plant asexual reproduction, and its main contents include: concept, spore reproduction, vegetative reproduction, tissue culture, and buds. The summary is comprehensive and meticulous, suitable as review materials.
This is a mind map about the reproductive development of animals, and its main contents include: insects, frogs, birds, sexual reproduction, and asexual reproduction. The summary is comprehensive and meticulous, suitable as review materials.
Microcontroller Principles and Applications
Basic knowledge of microcontrollers and embedded systems
Embedded
basic concept
Embedded systems are specific application-oriented, with computer technology as the core, and hardware and software based on specific applications. Portable microcomputer system tailor-made for software system
main feature
Small size and light weight
Low power consumption
lower cost
Rich application support
The composition of embedded technology
Embedded system hardware
embedded processor
It is the core of the embedded system and the hardware unit that controls and assists the operation of the system.
power supply system
Provide power to embedded systems
external memory system
Expand large-capacity memory through the external memory interface provided by the embedded processor
external device
Connect to external devices through the peripheral interface provided by the embedded processor chip
Embedded system software
Board support package
Embedded real-time operating system
app
Internal architecture of 8051 microcontroller
CPU
Exchange information with different types of storage in different address spaces
Execute logical and arithmetic instructions
program memory
Used to save program code to be executed
random access memory
Used to temporarily store data that needs to be saved temporarily in the program
interrupt system
Used for CPU processing of emergency events
Timer/Counter
Synchronize different events
External device interface module
Provides universal input/output
bus
A collection of related logical signals
STC microcontroller hardware knowledge
STC microcontroller IAP and ISP
ISP, that is, In-System Programming, a microcontroller chip with ISP function can directly write or erase programs to the chip on the circuit board through a simple download line, and supports online debugging.
IAP (In-Application Programming) means that the MCU can obtain new codes in the system and reprogram itself, that is, the program can be changed using the program.
Naming rules: ①, XXX ②, 15 ③, X ④X ⑤XX ⑥X- ⑦XX ⑧X ⑨-XXX ⑩X
1. Indicates STC, IAP or IRC
2. It means it is STC’s 15 series microcontroller.
3. Indicates the operating voltage of the microcontroller, represented by F, L, and W:
F means Flash, the working voltage is 3.8~5.5V
L means low voltage, the working voltage is 2.4~3.6V
W represents wide voltage, the operating voltage is 2.5~5.5V
4. Used to indicate the capacity of the SRAM storage space in the microcontroller.
5. Indicates the size of the program memory in the microcontroller
6. Indicates some special functions of the microcontroller
W: Indicates that there is a dedicated timer for power-down wake-up.
S: indicates there is a serial port
AS/PWM/AD: Indicates a set of high-speed asynchronous serial communication interface; SPI function; internal EEPROM function; A/D conversion function (PWM can also be used as a D/A converter); CCP/PWM/PCA function.
S4: Indicates that there are 4 sets of high-speed asynchronous serial communication interfaces; SPI function; internal EEPROM function; A/D conversion function (PWM can also be used as a D/A converter); CCP/PWM/PCA function.
7. Indicates the operating frequency of the microcontroller
8. Indicates the operating temperature range of the microcontroller.
C means commercial grade, its working temperature is 0~70℃.
Ⅰ indicates industrial grade, and its working temperature is -40~85℃.
9. Indicates the microcontroller package type
Dual in-line package, DIP
Thin square flat packaging, LQFP
Small Outline Package, SOP
Thin Shrink Small Outline Package, TSSOP
Square flat leadless package, QFN
10. Indicates the number of pins of the microcontroller
Pin definition
General I/O port, control/driver
Input: switch Output: motor
Data/address bus AD
External control POM, RAM
Serial communication
Receive RXDn
Send TXDn
External interrupt signal introduction port, INTN
Timing/counting counting pulse, pulse introduction T0, T1
I/O driving principle of STC microcontroller
Quasi-bidirectional output configuration
Can be used for output, input
Strong push-pull output configuration
Strong push-pull mode is generally used when larger drive current is required.
Configured for input only (high impedance)
This configuration cannot output or receive current, and can only be used as input data.
Open drain output configuration
STC microcontroller architecture
STC microcontroller CPU core functional unit
central processing unit
operator
8-bit arithmetic logic unit
arithmetic operations
Other operations
logic operation
Bitwise operations
accumulator
Used to save the results of most instruction operations, located in the special function register, address 0xE0
B register
Used for general purpose registers, located at the location of special function register 0xE0
program status word
Save some special bits
controller
Program CounterPC
Implement control and computing
sequential execution
non-sequential execution
command channel
fetch unit
Fetch instructions based on the address of the instruction program memory pointed to by the PC.
decoding unit
Translate the instruction based on the opcode part of the fetched instruction
execution unit
Control the arithmetic unit to complete the instruction
Stack and pointer
Mainly used to preserve the scene
CPU peripherals
Internal data RAM
external data space
Special function register SFR
Port mode control register
Provide P0 port, P1 group port, P2 group port, P3 group port, P4 group port, P5 group port, and P6 group port port, P7 group port
P0 port
P0M0 register P0M1 register
port register
STC microcontroller can read port status or write data to the port
clock divider
CPU dividers allow the CPU to run at different speeds
STC microcontroller memory structure and address space
Program Flash memory
Program memory space mapping
The STC microcontroller program storage space is located in the address range of 0x0000~0xFFFF
Program memory features
Provides more than 100,000 erasing and writing capabilities.
Low-voltage protection function, that is, erasing and programming of the program memory is prohibited under low-voltage conditions.
The program memory does not provide external read circuits, thus effectively preventing the cracking of user programs.
The program memory cannot be programmed until it has been erased.
When programming the program memory, the program code can be stored out of order.
The last 7 bytes of program memory set the globally unique ID number.
Erase in units of sectors.
Programming is done in bytes.
STC microcontroller provides the ability to erase, program and code encryption of Flash through a universal asynchronous serial port.
Data Flash memory
For implementing electrically erasable read-only memory
Features
The internal data Flash can be used as EEPROM through ISP/IAP technology.
The number of erases and writes is more than 100,000 times.
Measured in sectors, each sector contains 512 bytes.
Data memory erase operations are performed on a sector-by-sector basis.
Internal RAM memory
Internal RAM
0x00H~0xFFH
Internal RAM
0x0000~0x0EFF
interrupt system
Interrupt type
External interrupt 0
Timer/Counter T0
External interrupt 1
Timer/Counter T1
serial port interrupt
IE (interrupt type)
Main switch EA
EX0, ET0, EX1, ET1, ES, EA
TOCN (interrupt flag bit and interrupt mode)
IT0, IE0, IT1, IE1, TR0, TF0, TR0, TR1, TF1
IT is the trigger mode, 0 is low level, 1 is falling edge
TF is the timer overflow flag bit
IP (priority level)
natural order
External 0>Define 0>External 1>Define 1>Serial port
P.S.
Serial port interrupt priority control bit
PT1
Timer 1 interrupt priority
PX1
External interrupt 1 interrupt priority
PT0
PX0
interrupt process
interrupt request
interrupt response
interrupt service
interrupt return
Timer/Counter
Structure and working principle
substance
The falling edge of the accumulated pulse, after reaching a certain number, overflows and interrupts
Classification
timer
The pulse comes from the internal crystal oscillator
counter
The pulse comes from outside
several concepts
Counter capacity
The measurement range is expressed in binary digits, and the eight digits are 2 to the 8th power 256
Counter overflow
After reaching the measurement range, another pulse will return to 0.
overflow mark
Similar to the carry flag, the overflow flag causes an interrupt
Count initial value
16 bits, 65535, to count 100, set the initial value to 65436
control
Mode control register (TMOD)
The byte address is 89H
GATE
Gate control bit
Set to 0 to start Tx and has nothing to do with external interrupts
C/T(-)
Counting, timing function selection bit
Set 1 to count
Set 0 for timing
M1
M0
Working mode definition bit
Four ways of working
00 mode 0
13 bits
01 Method 1
16 bit
10 Method 2
8-bit auto-reload
11 Method 3
T0 is divided into two independent eight bits, and T1 is discontinued.
The lower four bits are timer 0, the higher four bits are timer 1
It cannot be bit addressed and can only be set using byte instructions.
Control register (TCON)
The byte address is 88H
TF1
The T1 timer overflow interrupt flag is set by hardware when it overflows, interrupt response, and automatically cleared.
TR1
Run control bit, when set to 1, starts corresponding T0/T1, set by software
TF0
The T0 timer overflow interrupt flag is set by hardware when it overflows, interrupt response, and automatically cleared.
TR0
Run control bit, when set to 1, starts the corresponding T0/T1, set by software
IE1
IT1
IE0
IT0
Way of working
Mode 0
13 bits
Way 1
THx and TLx form a 16-bit adding counter
The maximum count pulse is 65536
When GATE is set to 1, the switch of the counter is related to the external interrupt.
Way 2
16 bit
TLx eight bits to count
Eight bits of THx to store the initial value
After counting once, H will be imported once.
Way 3
Counter and pulse frequency
The highest external frequency is 1/24 of the oscillation period
Crystal oscillator 12MHz→250kHz
serial
Data transmission between microcontrollers and microcontrollers, microcontrollers and other devices
Parallel, serial
Parallel is slower than serial, and parallel can only be used at short distances
Serial communication method
Asynchronous communication
Data is transmitted frame by frame
Synchronous communication
Stop bits are not used, strict synchronization is required, and it is relatively rarely used.
Serial communication port control
Serial control register SCON
SM0/FE
SM1
Determine the communication method together with SM0
SM2
Allow mode 2 and mode 3 multi-machine communication control bit
REN
Enable or disable serial reception control bit
TB8
Data check bit or flag bit indicating address frame/data frame in multi-machine communication (this bit is not used in mode 0 and mode 1)
RB8
Parity data check bit or flag bit of address frame/data frame (this bit is not used in mode 0 and mode 1)
T1
Send interrupt flag bit
R1
Receive interrupt flag bit
Power control register PCON
SMOD
SMOD0
LVDF
POF
GF1
GF0
PD
IDL
A microcontroller that supports IAP mode must also support ISP mode.