当前位置:网站首页>How to learn SCM based on zero?
How to learn SCM based on zero?
2022-07-23 09:52:00 【an520_】
Generally speaking , Want to learn Single chip microcomputer , Many are also because Embedded reasons , But since they all choose to study It's too late , Then the content of learning is to understand the hardware structure of single chip microcomputer .
First step : Numbers I/O Application
In most SCM experiments , The running lantern experiment is exactly the number I/O Typical application of , It is also the first reason why the experiment of the running lantern is arranged .
Through the single-chip computer I/O The pin position is set or cleared to turn on or off LED The lamp , Simple though , But this is the number Logic function in circuit . mathematics I/O The experiment of application and button experiment , When you press a key , some LED The light is on . Numbers I/O Experiments teach us the programming idea of single chip microcomputer , You must first configure the corresponding registers of the MCU , To initialize I/O Pin , Only in this way can this pin have the function of digital input and output .
How long does it take for MCU self-study to use a built-in or external function of MCU , It is to set the registers related to this function , initialization , This is the characteristic of MCU programming . Is less 4、5 A function is done , More than a dozen lines of program , Want to have patience , Don't be afraid of trouble , All single-chip computers are like this .
The second step :RS232 A serial port communication
Single chip computers all have UART Interface , This simple 、 Ancient means of communication can communicate with us PC The machine RS232 Interface is directly connected to communication , Of course , Because their level logic is different , You must use a RS232 Level conversion chip can be compared with PC Machine connection , for example Max232 chip .
The third step : How long does it take to teach yourself how to use the timer by single chip microcomputer
Learn to use timers , You can use SCM to realize a typical sequential logic circuit . The application of sequential logic circuit is the most powerful 、 The most extensive .
for example , In industrial control , We let someone Switch every 1 Open and close once every second . This scheme can be achieved by ordinary numbers Integrated circuit implementation , It can also be done through PLC To achieve , It can also be done through CPLD or FPGA To achieve , But only the implementation of single chip microcomputer is the simplest , The cost is also the most economical . Timer is one of the most important internal resources of MCU , It is also the basis for the realization of logic and time control .
Step four : interrupt
In SCM software design architecture , One of the characteristics of a program is its circular execution , It is also a drawback .
Each operation The execution of instructions requires a certain amount of execution time , If the program does not execute the instruction , Then the action of this command will not trigger , In this way, many rapid events will be ignored , For example, square wave Rising edge of frequency detection . The interrupt function is designed to respond to external events immediately when the single chip microcomputer program is running normally . When the interrupt function is executed , MCU gives priority to interrupt program , When interrupt processing is complete , Return to the normal program execution of the single chip microcomputer .
The mechanism of interruption is relatively easy to understand , But when to open the interrupt , When to close 、 Mask interrupt , How to configure some functions that can be interrupted , What procedures should be executed in the interrupt , It takes time to understand and practice the requirements of these procedures . After the interruption of learning , You can write programs with complex structures and functions , You can flash a little LED The lamp , While scanning the keys , While sending data , You can also do many things ……
Make a comparison , The interrupt function can make the single-chip microcomputer eat in the bowl , Look at the pot . According to the legend 8020 The laws of , If you master the four steps mentioned above , that , You have learned 80% Content. .
Step five :I2C、SPI communication interface
After all, the resources of single-chip microcomputer system are limited , And the use of I2C、SPI Communication interface expansion of peripherals is the most commonly used method , It is also a very important method .
These two communication interfaces are Serial communication interface , How long does it take for single chip microcomputer self-study? The typical basic experiment is I2C Of EEPROM Experiments and SPI Of SD Card reading and writing experiment .
Step six : Compare , capture ,PWM function
Compare , Capture and PWM The function can make the single chip microcomputer more suitable Motor control , Signal detection , Realize the adjustment of motor speed and step .PWM Bo is now LED The main means of dimming . Here we have preliminarily touched the analog circuit part of the digital circuit .
Step seven :A/D Analog digital acquisition
At present, SCM basically comes with multi-channel A/D A / D converter , Through these A/D The converter can obtain analog quantity by single chip microcomputer , Used to detect voltage 、 Electric current and other signals . When learning, we should distinguish between analog and digital , Reference voltage , Sampling time , Conversion rate , Conversion error and other important concepts . This step learned the part of digital circuit controlling analog circuit , And the simplest A/D Analog to digital converter is voltmeter experiment .
Step eight : Study USB Interface 、TCP/IP agreement 、 How long does it take for industrial bus single chip microcomputer to learn by itself
At present, the mainstream communication protocol is USB Association —— High speed communication interface between lower computer and upper computer ;TCP/IP—— Universal communication protocol for Internet use ; Industrial bus —— Such as Modbus,CANOpen And other industrial control protocols between various modules .
These will be applied in future projects , Firmware integrated into MCU , And it is also a development direction of current product development .
The time to learn SCM is not short , More content , Judge the time according to personal learning .
however , As long as you seriously go to SCM , Then you can win it quickly .
边栏推荐
猜你喜欢
![[SSM]异常处理](/img/bb/2669d2a3ee725aa4ab8443aed0a8be.png)
[SSM]异常处理

CAD如何绘制带有弧形的箭头
![[ssm] exception handling](/img/bb/2669d2a3ee725aa4ab8443aed0a8be.png)
[ssm] exception handling

PNA specification information | soybean peroxidase labeled PNA (peptide nucleic acid, PNA)

PNA PNA custom service | PNA clamp PCR (pna-pcr) | cgappna multivalent PNA ligand

Judge whether it is void type

QML (17) -- read and write txt files

WordPress网站SEO完整教程

大专学历想0基础学编程以后找工作可行吗 ?

nchar字符引起的ora-12899错误
随机推荐
I want to learn financial management in digging money. Is it safe to open an account?
【Node中间层实践(四)】----express中间层的逻辑处理
MySQL数据库提权学习
canal 02
Ardunio——ULN2003驱动板和直流电机风扇——控制风扇转速
结合实战,浅析GB/T 28181(二)——设备目录同步
可视化全链路日志追踪
本地提权的学习
J.Serval and Essay(tarjan求拓扑序)
Is CITIC futures a regular futures company and is it safe to open an account?
Peptide nucleic acid coupled polypeptide ile Glu Gly Arg PNA (s-2222) | BOC Leu Gly Arg PNA
实现多层级条件查询(类似京东多层级添加查询)
【Node中间层实践小记(一)】----搭建项目框架
Leetcode 110. 平衡二叉树
Weekly recommended short video: why write such a book?
PNA specification information | soybean peroxidase labeled PNA (peptide nucleic acid, PNA)
Liunx上杀死一进程
WordPress网站SEO完整教程
2022.7.22 js入门 常用数据类型及其方法
C——结构体