当前位置:网站首页>How does SCM work?
How does SCM work?
2022-07-22 15:53:00 【an520_】
One 、 Analysis of the internal structure of single chip microcomputer
Let's think about a problem , When we write an instruction into the MCU in the programmer , Then remove the MCU , The single chip microcomputer can execute this instruction , Then this instruction must be stored somewhere in the MCU , And this place can still keep this instruction from being lost after the MCU is powered down , What is this place ? This place is the read only memory inside the single chip microcomputer, that is ROM(READ ONLY MEMORY). Why call it read only memory ? Didn't we write in two numbers just now ?
Originally in 89C51 Medium ROM Is an electrically erasable ROM, be called FLASH ROM, The programmer we used just now , Under special conditions, by external equipment ROM Write operation , Under the normal working conditions of single chip microcomputer , You can only read from that side , You can't write data in , So we still call it ROM.
Two 、 Some basic concepts
1、 The nature of numbers and physical phenomena
We know , The computer can perform mathematical operations , This makes it very difficult for us to understand , Computer , Although we don't know its composition , But they are just some electronic components , How can we do mathematical operations ? We do math problems such as 37+45 Here's how it works , First write on paper 37, Then write below 45, Then the brain calculates , Finally, write the results , Raw materials for computing :37、45 And result :82 It's all written on paper , Where is the computer placed ?
To solve this problem , Let's do an experiment first : Here is a lamp , We know the lights are either on , Or it doesn't light up , There are two states , We can use ’0’ and ’1’ To replace these two states , The specified light is ’1’, If it doesn't light up, it means ’0’. Now put on two lights , There are several States ? Let's take a look at the list :
Please write down 3 Condition of lamp 000 001 010 011 100 101 110 111 Let's see , This 000,001,101 Isn't it the binary number we learned ? Originally , The light on and off is just a physical phenomenon , But when we put them in a certain order , The light on and off represents the number . Let's take another Abstract step , Why is the light on ? Because the output circuit outputs high level , Energize the light . therefore , When the light is on or off, it can be replaced by whether the output of the circuit is high level or low level . such , Numbers and levels are high 、 Low contact .( Please think about it , What other similar examples have we seen ?( Naval ) Lantern language 、 Flag language , The telegraph , Even red 、 A green light ). Articles that help to understand the level :CPU How to identify the code we write ?
2、 Bit means
Through the above experiment, we already know : A light is on, or the level of a line , Can represent two states :0 and 1. In fact, this is a binary bit , So we call a thread a “ position ”, use BIT Express .
3、 The meaning of bytes
A line can represent 0 and 1, Two lines can express 00,01,10,11 Four kinds of state , That is, it can express 0 To 3, And three roots can express 0~7, Commonly used in computers 8 Put the wires together , Simultaneous counting , I can represent 0-255 altogether 256 States . this 8 A thread or 8 A bit is called a byte (BYTE).
How memory works
1、 Memory structure
Memory is the place where data is stored . It uses the level to store data , in other words , What it stores is actually the high level 、 low , Not what we're used to thinking 1234 Numbers like this , such , One of our mysteries was solved , There's nothing mysterious about computers .
As shown on the left above : A memory is like a small drawer , There are eight small squares in a small drawer , Each small cell is used to store “ Electric charge ” Of , Charge is transferred in or released through the wire connected to it , As for how the charge is stored in the small lattice , We don't have to worry about it , You can think of wires as water pipes , The charge in the small lattice is like water , That's easy to understand . Each small drawer in the memory is a place for data , We call it a “ unit ”.
With such a structure , We can start storing data , Want to put in a data 12, That is to say 00001100, We just need to fill the second and third cells with electric charge , Just let go of the charge in other small cells ( Look at the picture above, right ). But the problem came out , Look at the picture above, right , A memory has many units , The wires are connected in parallel , When you put an electric charge , Will put the charge into all the cells , And when the charge is released , Will discharge the charge in each unit , In this case , No matter how many memory units there are , Can only put the same number , This, of course, is not what we want , therefore , A slight change in structure , Look at the picture above, right , There is a control line on each unit , Which unit do I want to put the data into , Just send a signal to the control line of this unit , This control line turns the switch on , So the charge can flow freely , There is no signal on the control line of other units , So the switch doesn't open , Not affected , such , As long as the control lines of different units are controlled , You can write different data to each unit , Again , If you want to get data from a unit , Just turn on the corresponding control switch .
2、 Memory decoding
that , How do we control the control lines of each unit ? This is not easy , Just lead the control line of each unit to the outside of the integrated circuit ? It's not that simple , a slice 27512 There are... In the memory 65536 A unit , Lead out every line , This integrated circuit must have 6 More than ten thousand feet ? no way , What do I do ? Try to reduce the number of lines . We have a method called decoding , A brief introduction : A line can represent 2 States ,2 The root line can represent 4 States ,3 The root line can represent several ,256 How many lines are needed to represent ?8 Kind of ,8 Root line , therefore 65536 In this state, we just need 16 One line can represent .
3、 Memory chip selection and bus concept
thus , The decoding problem is solved , Let's focus on another problem . Where do the eight wires fed into each unit come from ? It's connected from the computer , In a general way , These eight wires are connected to a memory , And other devices . So the problem comes out , Since these eight wires are not dedicated between memory and computer , If you always connect a unit to these eight lines , It's not good , For example, the value in this memory unit is 0FFH Another memory unit is 00H, So this line is at a high level , Still low ? Don't you have to fight? It depends on who has hurt ? So we need to separate them . Of course, the solution is simple , When the outside wire is connected to the pin of the integrated circuit, come in , Not directly connected to each unit , Just add another set of switches in the middle . Usually we leave the switch on , If you really want to write data to this memory , Or to read data from memory , Just turn the switch on again . This set of switches is selected by three leads : Read control end 、 Write control terminal and chip selection terminal . To write data to the chip , Select this piece first , Then send a write signal , The switch is closed , And send the data ( Electric charge ) Write on chip . If you want to read , Select this piece first , Then send a read signal , The switch is closed , The data is sent out . The read and write signals are also connected to another memory at the same time , However, due to the different selection ends , So although there are read or write signals , But there is no chip selection signal , So another memory won't “ misunderstanding ” And open the door , Cause conflict . How about choosing two chips at the same time ? As long as it is a well-designed system, it will not , Because it is controlled by calculation , Not controlled by us , If there is a case that two pieces are selected at the same time , There is something wrong with the circuit , This is not in our discussion .
We have seen from the above introduction , The eight wires used to transmit data are not dedicated , But many devices are shared by everyone , So we call it data bus , The English name of the bus is BUS, It's always the bus lane , Anyone can go . And sixteen address lines are also connected , Call it address bus .
【 Free information package of online disk collected by yourself , If you need it, you can collect it yourself 】:
【 Share some learning tutorials below 】:
From single chip microcomputer to embedded system linux What we need to do
Intelligent temperature control small fan
(stm32 USART Serial port application )
边栏推荐
- JD-H5开发
- 商品信息SKU数据库设计
- Liunx环境
- Leetcode 0814. binary tree pruning
- 零基础学习CANoe Panel(2)—— 控件布局
- EACCES: permission denied, unlink ‘/usr/local/bin/code‘
- LastWordLen
- Chapter 3 - creating and maintaining MySQL data tables
- Check for degenerate boxes检查退化框
- How does the 2022 social e-commerce model split marketing? -- Share purchase
猜你喜欢
Know garbage recycling
How to improve the efficiency of test case review?
img.shape[-2:]/len(img.shape[-2:]):GeneralizedRCNN:original_image_sizes中的 torch._assert
程序环境和预处理
Section 5 of Chapter 3: return value
2面字节,被面试官抬着走出去,分享给大家
【代码笔记】—U-Net
Advertising is everywhere. How can we use advertising to promote our products?
EACCES: permission denied, unlink ‘/usr/local/bin/code‘
C language outputs the number of all daffodils
随机推荐
Opencn learning Day3
C语言力扣第38题之外观数列。三种方法(遍历法、递归法与狼灭法)
微服务真的不挑数据库吗?如何选择?
Zero basic learning canoe panel (2) -- control layout
Product banner style type analysis
社交电商:链动2+1-入口快速裂变的模式
3年测试在职经验,面试测试岗连20k都拿不到了吗?有这么坑?
Creation and call of QT dynamic DLL
滑动窗口框架
[error] solution: not creating XLA devices, TF_ xla_ enable_ xla_ devices not set
C语言编写九九乘法表,实现不同三角形形状表格输出
10个自动化测试框架,测试工程师用起来
Statistics, calculate the data ratio of each department in SQL
C语言题库 part.1
10 automated test frameworks for test engineers
MySQL installation failed. I don't know why
How to improve the efficiency of test case review?
Monotonic stack framework
60 open-ended test questions, recite them and get a pay rise directly
玩转CANoe,博客目录大全