当前位置:网站首页>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
}
边栏推荐
猜你喜欢
我那“不好惹”的00后下属:不差钱,怼领导,抵制加班
Aosikang biological sprint scientific innovation board of Hillhouse Investment: annual revenue of 450million yuan, lost cooperation with kangxinuo
迅为iTOP-IMX6ULL开发板Pinctrl和GPIO子系统实验-修改设备树文件
Vscade editor esp32 header file wavy line does not jump completely solved
10 张图打开 CPU 缓存一致性的大门
[learning notes] zkw segment tree
PAcP learning note 1: programming with pcap
Differences between MySQL storage engine MyISAM and InnoDB
error LNK2019: 无法解析的外部符号
【学习笔记】zkw 线段树
随机推荐
国泰君安证券开户怎么开的?开户安全吗?
事务的七种传播行为
初学XML
分布式事务解决方案
Isprs2021/ remote sensing image cloud detection: a geographic information driven method and a new large-scale remote sensing cloud / snow detection data set
Summary of import, export, backup and recovery of mongodb
【无标题】
10 张图打开 CPU 缓存一致性的大门
服务器到服务器 (S2S) 事件 (Adjust)
HZOJ #235. Recursive implementation of exponential enumeration
Signal strength (RSSI) knowledge sorting
RealBasicVSR测试图片、视频
分屏bug 小记
我那“不好惹”的00后下属:不差钱,怼领导,抵制加班
File operation command
The difference between cache and buffer
regular expression
MongoDB的用户管理总结
Enterprise custom form engine solution (XII) -- experience code directory structure
ISPRS2021/遥感影像云检测:一种地理信息驱动的方法和一种新的大规模遥感云/雪检测数据集