当前位置:网站首页>LED light of single chip microcomputer learning notes
LED light of single chip microcomputer learning notes
2022-07-07 13:13:00 【ly_ zszcyx】
Use the development board :
Puzhong science and technology development board
Compiling software :
keil
Briefly review the LED (led), The core of LED is made of P Type semiconducting body and N Type semiconductor Composed of wafer , stay P Type semiconductor and N There is a transition layer between type a semiconductors , be called PN junction . It has a single conductivity .
Positive and negative judgment :
Usually :
1、 Yes The gap One end of is negative ;
2、 The end with the horizontal bar is the negative pole ;
3、 One end with a white parallel bar is a negative pole ;
4、 One end in the direction of the triangular arrow is the negative pole ;
5、 One end of the small circle of plug-in diode silk screen printing is the negative pole , The big circle is the positive pole .
In vertical position welding In this case, the original body is in the positive ring
6、 The square hole of the plug-in LED is the first pin and the positive pole is the first pin .
Schematic diagram of development board :

Light a lamp , Set the corresponding discipline to low level
sbit Variable name = Address values ;
Code :
#include "reg52.h" // This file defines some special function registers of MCU
#include<intrins.h> // Because you're going to use the left-right shift function , So add this header file
sbit led0 = P2^0; // The of single chip microcomputer P2.0 The port is defined as led0
sbit led1 = P2^1;
sbit led2 = P2^2;
sbit led3 = P2^3;
sbit led4 = P2^4;
sbit led5 = P2^5;
sbit led6 = P2^6;
sbit led7 = P2^7;
// Lighten up 8 individual led The lamp
void lighterLed()
{
while(1)
{
led0=0; //P2.0 The port is set to low level
led1=0; //P2.1 The port is set to low level
led2=0; //P2.2 The port is set to low level
led3=0; //P2.3 The port is set to low level
led4=0; //P2.4 The port is set to low level
led5=0; //P2.5 The port is set to low level
led6=0; //P2.6 The port is set to low level
//led7=0; //P2.7 The port is set to low level
}
}
/*******************************************************************************
* Letter Count name : main
* The functionality : The main function
* transport Enter into : nothing
* transport Out : nothing
*******************************************************************************/
void main()
{
lighterLed(); // Lighten up LED
}边栏推荐
- MongoDB内部的存储原理
- 单片机原理期末复习笔记
- 关于 appium 如何关闭 app (已解决)
- 分布式事务解决方案
- Unity build error: the name "editorutility" does not exist in the current context
- [QNX Hypervisor 2.2用户手册]6.3.4 虚拟寄存器(guest_shm.h)
- Grep of three swordsmen in text processing
- Lingyunguang of Dachen and Xiaomi investment is listed: the market value is 15.3 billion, and the machine is implanted into the eyes and brain
- Go language learning notes - structure
- Scripy tutorial classic practice [New Concept English]
猜你喜欢

PAcP learning note 1: programming with pcap

【学习笔记】AGC010

Per capita Swiss number series, Swiss number 4 generation JS reverse analysis

【黑马早报】华为辟谣“军师”陈春花;恒驰5预售价17.9万元;周杰伦新专辑MV 3小时播放量破亿;法华寺回应万元月薪招人...

基于鲲鹏原生安全,打造安全可信的计算平台

Sequoia China completed the new phase of $9billion fund raising

. Net ultimate productivity of efcore sub table sub database fully automated migration codefirst

云检测2020:用于高分辨率遥感图像中云检测的自注意力生成对抗网络Self-Attentive Generative Adversarial Network for Cloud Detection

COSCon'22 社区召集令来啦!Open the World,邀请所有社区一起拥抱开源,打开新世界~

记一次 .NET 某新能源系统 线程疯涨 分析
随机推荐
《开源圆桌派》第十一期“冰与火之歌”——如何平衡开源与安全间的天然矛盾?
认养一头牛冲刺A股:拟募资18.5亿 徐晓波持股近40%
工具箱之 IKVM.NET 项目新进展
【等保】云计算安全扩展要求关注的安全目标和实现方式区分原则有哪些?
Unity 构建错误:当前上下文中不存在名称“EditorUtility”
PAcP learning note 1: programming with pcap
leecode3. 无重复字符的最长子串
MATLAB中polarscatter函数使用
shell 批量文件名(不含扩展名)小写改大写
【学习笔记】zkw 线段树
Common text processing tools
PACP学习笔记三:PCAP方法说明
【学习笔记】线段树选做
Smart cloud health listed: with a market value of HK $15billion, SIG Jingwei and Jingxin fund are shareholders
Sample chapter of "uncover the secrets of asp.net core 6 framework" [200 pages /5 chapters]
Summary of import, export, backup and recovery of mongodb
云检测2020:用于高分辨率遥感图像中云检测的自注意力生成对抗网络Self-Attentive Generative Adversarial Network for Cloud Detection
Pay close attention to the work of safety production and make every effort to ensure the safety of people's lives and property
PAcP learning note 3: pcap method description
线程池拒绝策略最佳实践