当前位置:网站首页>Light up the running light, rough notes for beginners (1)
Light up the running light, rough notes for beginners (1)
2022-07-05 07:18:00 【After reading thousands of books, you can pick them up and put 】
Turn on the running water lamp , Rough notes for beginners (1)
As a beginner, what I want most is to be able to be taught in detail without professional terms , But I often don't know where to start , So here is a summary of useful and understandable ways I have heard , Mixed with my learning ideas , Also record my learning process , Maybe in the end , The more you learn, the easier it is to remember , But at first, I always like to record in detail .
For a simple description, the following low level is used “-” Express . For high level “+” Express
Lighten up led Code
Latch open , And turn it off after finishing the operation .
It's a matter of habits , It is also to prevent programming logic errors later .
No addition “while(1);”
You write a piece of code, and the single chip computer runs super fast all at once , You can't see the light on .
And it can be seen on the board with a latch without adding it, because there is a latch .
( It means , No addition while For example, the lamp delay setting is 1 millisecond , If there is no latch at the same time , You can't see it bright, but you can't see the result with the naked eye .)
added while(1), It will be executed until while It has been implemented here while.while Except for conditional restrictions .
Schematic diagram used
①
When Y4c For high voltage Q1-Q8 The level of will follow
D1-D8 Change by change .
(D1+,Q1 also +);
If at this time Q1 by “+”
Y4c Change it to “-”
Well, then D1 Change it to “-”, here Q1 Will only maintain the previous state , That is to say “+”, Not with me D1 Change by change .
( So we should make Q1-Q2 along with D1-D2 Change and change requires Y4c by “+”).
②
It's up here 4 One is concentrated on the following chip
The above one is counterproductive , So be Y4c take “+” that Y4 Just take “-”.
③
*** The principle of the above diagram is to convert binary to decimal
Here is an example
If you want to light led L1, You need to look at the flow chart like this
①
y4c by “+” Can we make Q1 along with D1 Change and change
②
Y4c for “+” be
Y4 for “-”
③
Y4 for “-” be Y4 for “0”
therefore P2 The first three are 100
Back 5 The bit hypothesis is 00000.
So point L1 The code is ,P2=0x80;P0=0x01;
( Lighten up L1——Y4c for “+” Can we make ——D1 by 0——Q1 Also for the 0
Y4c for “+”——Y4 for “-”——Y4 Corresponding P27P26P25 From binary to decimal, the result is 4, So that Y4=0——Y4=0——Y4“-”——Y4c“+”——Q1 Can follow D1 Change and change —— At this time make D1=0 be ——L1 On one side “+” On one side “-” The light is on .)
About P2=0x80;P0=0xff;P2=0x00;
P2=0x80 open Y4 Latch ;
P0=0x00 Close all led The lamp ;
P2=0x00 close Y4 Latch ;
therefore P2=0x80;
About P2=0xa0;P0=0x00;P2=0x00;
Both sides of the buzzer are regular off
N BUZZ To be regular
therefore P0=0x00;// Turn off the buzzer
P2=0xa0;// open Y5 Latch ;
P2=0x00;// Close the latch ;
P2 For binary order P27 P26 P25 P24 P23 P22 P21 P20
P0 For binary order P07 P06 P05 P04 P03 P02 P01 P00
How to only give P27P26P25 Assign values without affecting the remaining .
1 It's true 0 For false ;
use “|“”&“
P2=0x9f&(P2|=0xe0) ;// open Y4
|: Self understanding is equivalent to “∪”
Two true is true ,
Two false is false ,
One true and one false is true .
&: amount to “∩”
Two true is true ,
Two false is false ,
One true and one false is false .
Suppose at the beginning P2 All eight don't know
???? ????
or “|” On “e0” The process
?? ?? ????
1 1 1 0 0 0 0 0(e0)
Or go up 1 1 1 ? ????
The process is as follows
111????? And again 10011111(9f) And “&” The process
100?????
The process is as follows
In this way, only the first three mouths are changed , And make the remaining several mouths unchanged .
Relay
The same is true of the way the buzzer is used
About simple usage
In short , About lighting , You only need to know the function of the schematic diagram of the lamp , If you take the opposite , What will change with what changes , Common Yang or common Yin ? When one end is “+” one end “-” Then it's all right .
边栏推荐
- How can Oracle SQL statements modify fields that are not allowed to be null to allow nulls?
- 基于Cortex-M3、M4的GPIO口位带操作宏定义(可总线输入输出,可用于STM32、ADuCM4050等)
- SD_CMD_SEND_SHIFT_REGISTER
- Binary search (half search)
- M2DGR 多源多场景 地面机器人SLAM数据集
- ROS2——ROS2对比ROS1(二)
- Jenkins reported an error. Illegal character: '\ufeff'. Class, interface or enum are required
- The SQL implementation has multiple records with the same ID, and the latest one is taken
- Ros2 - configuration development environment (V)
- 【软件测试】04 -- 软件测试与软件开发
猜你喜欢
逻辑结构与物理结构
Word import literature -mendeley
Inftnews | drink tea and send virtual stocks? Analysis of Naixue's tea "coin issuance"
Ros2 - first acquaintance with ros2 (I)
SOC_SD_CMD_FSM
Logical structure and physical structure
Steps and FAQs of connecting windows Navicat to Alibaba cloud server MySQL
[software testing] 02 -- software defect management
docker安装mysql并使用navicat连接
iNFTnews | 喝茶送虚拟股票?浅析奈雪的茶“发币”
随机推荐
Hdu1231 maximum continuous subsequence (divide and conquer or dynamic gauge or double pointer)
Intelligent target detection 59 -- detailed explanation of pytoch focal loss and its implementation in yolov4
[untitled]
1290_ Implementation analysis of prvtaskistasksuspended() interface in FreeRTOS
Ros2 topic (VIII)
Delayqueue usage and scenarios of delay queue
【软件测试】02 -- 软件缺陷管理
ORACLE CREATE SEQUENCE,ALTER SEQUENCE,DROP SEQUENCE
How can Oracle SQL statements modify fields that are not allowed to be null to allow nulls?
Ros2 - configuration development environment (V)
Three body goal management notes
纯碱是做什么的?
能量守恒和打造能量缺口
Database SQL practice 3. Find the current salary details of the current leaders of each department and their corresponding department number Dept_ no
PowerManagerService(一)— 初始化
Unconventional ending disconnected from the target VM, address: '127.0.0.1:62635', transport: 'socket‘
The golang timer uses the stepped pit: the timer is executed once a day
list. files: List the Files in a Directory/Folder
并发编程 — 死锁排查及处理
基于Cortex-M3、M4的GPIO口位带操作宏定义(可总线输入输出,可用于STM32、ADuCM4050等)