Introduction to 51 MCU - Controlling LED Lights

Publisher:xxoke624Latest update time:2022-06-15 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. LED

1.1.What is LED?

LED (light-emitting diode), commonly known as LED small lamp, is a light-emitting display device made of semiconductor materials such as gallium phosphide (GaP) that can directly convert electrical energy into light energy. When a certain current passes through the LED, it will emit light. Different LEDs can emit different colors of light, the most common ones are red, yellow, etc., as shown in the figure:


insert image description here

The following points are mainly explained about the appearance characteristics of LED.

(1) The color of the shell of a monochrome LED indicates its luminous color. The shell of the LED is transparent.

(2) A single-color LED has only two pins, which have positive and negative poles. A multi-color LED has three pins.

(3) The LED has a distinctive appearance, so it is easy to identify the LED.


1.2. Types of LEDs

insert image description here

1.3. Main parameters of LED

Electrical parameters:

(1) Forward operating current IF. It refers to the forward current value when the light-emitting diode emits light normally. The operating current of the light-emitting diode is generally 10 to 20 mA.

(2) Forward operating voltage UF. It is the forward operating voltage across the LED at a given forward current. It is usually measured at IF = 20mA, and the forward operating voltage of the LED is 1.4 to 3V. When the external temperature rises, the forward operating voltage of the LED will decrease.

(3) Volt-ampere characteristic. It refers to the relationship between the voltage and current of a light-emitting diode.


Limit parameters:

(1) Allowable power consumption Pm. It is the maximum value of the product of the forward DC voltage across the LED and the current flowing through it. If this value is exceeded, the LED will heat up and be damaged.

(2) Maximum forward DC current IFm. It is the maximum forward DC current allowed. If it exceeds this value, the diode will be damaged.

(3) Maximum reverse voltage URm. It is the maximum reverse voltage allowed. If the reverse voltage exceeds this value, the light-emitting diode may be damaged by breakdown.

(4) Working environment topm. It is the ambient temperature range in which the light-emitting diode can work normally. If the temperature is lower or higher than this range, the light-emitting diode will not work normally and the efficiency will be greatly reduced.


1.4. Main characteristics of LED

Volt-ampere characteristics

The volt-ampere characteristics of LEDs are similar to those of ordinary diodes, except that the forward conduction voltage of LEDs is larger. The reverse breakdown voltage of low-current LEDs is very small, ranging from 6V to more than ten volts, which is smaller than that of ordinary diodes. The figure below shows the forward volt-ampere characteristic curve of LEDs.

insert image description here

The figure below is the LED volt-ampere characteristic curve, which includes forward and reverse characteristics. LED has an input volt-ampere characteristic curve similar to that of a general semiconductor transistor.

insert image description here

The various sections of the volt-ampere characteristic curve are explained below.

(1) OA segment. This is the forward dead zone. UA is the voltage that turns on the LED.

(2) AB segment. This is the working area. In this segment, generally, as the voltage increases, the current also increases, and the luminous brightness also increases.


In this section, special attention should be paid. If no protection is added, when the forward voltage increases to a certain value, the forward voltage of the LED will decrease, while the forward current will increase. If there is no protection circuit, the LED will be burned out due to the increase in current.


(3) OC segment. This is the reverse dead zone. When a reverse voltage is applied to the light-emitting diode, it does not emit light (does not work), but there is a reverse current. This reverse current is usually very small, generally within a few microamperes. In 1990-1995, the reverse current was set at 10μA; in 1996-2000, the reverse current was set at 5μA. Currently, the reverse current is generally below 3μA, but basically 0μA.

(4) CD segment. This is the reverse breakdown region. The reverse voltage of the LED should generally not exceed 10V, and the maximum should not exceed 15V. If this voltage is exceeded, reverse breakdown will occur, causing the light-emitting diode to be scrapped.


In this section, the LED has a large reverse breakdown current (several mA). This breakdown is not a thermal breakdown and will not cause damage. Some AC sockets and AC indicator lights on AC power switches use LEDs, and the LEDs work in this section during the negative half cycle of the AC power.


Forward resistance and reverse resistance characteristics

The forward and reverse resistances of LEDs are much larger than those of ordinary diodes. Understanding this is of great guiding significance for detecting diodes.


Relationship between working current and relative luminous intensity

The figure below shows the characteristic curve of the relationship between the working current and the relative intensity of light emitted by a light-emitting diode. For a red LED, the relative intensity of light emitted increases as the forward working current increases. When the working current reaches a certain level, the curve tends to be flat (saturated), indicating that the relative intensity of light emitted tends to be saturated; for a green LED, the relative intensity of light emitted increases as the working current increases, but there is no saturation phenomenon.

insert image description here

Relationship between luminous intensity and ambient temperature

The figure below shows the characteristic curve of the relationship between the luminous intensity of the LED and the ambient temperature. The lower the temperature, the greater the luminous intensity. When the ambient temperature rises, the luminous intensity will drop significantly.

insert image description here

5. Relationship between maximum allowable operating current and ambient temperature

The figure below shows the characteristic curve of the maximum allowable operating current and ambient temperature. When the ambient temperature reaches a certain level, the maximum allowable operating current decreases rapidly and eventually reaches zero, which means that LEDs are more likely to be damaged in high ambient temperatures. This is also the reason why LEDs are afraid of heat.

insert image description here

6. Other characteristic curves

insert image description here

1.5.LED pin polarity identification method

In order not to affect the normal lighting of the LED, the model and polarity are not marked on the shell. Therefore, the identification of the positive and negative pins of the LED mainly depends on the appearance characteristics and the detection of the multimeter.


Pin length identification method

The picture below shows an LED that uses the length of the pins to distinguish the positive and negative polarity pins. Its two pins are one long and one short. The long one is the positive pole and the short one is the negative pole.

insert image description here

Key-type identification method

The figure below shows the method of using a key to indicate the positive polarity pin. There is a key on the LED base, and the pin closest to this key is the positive pole.

insert image description here

3-pin LED pin identification method

The following figure shows the pin distribution pattern and internal circuit diagram of a 3-pin LED. There are two light-emitting diodes of different colors. K is the common pin.

insert image description here

The figure below is a schematic diagram of another method for identifying the pins of a 3-pin color-changing LED. It has a protruding key, and each pin can be easily identified based on its appearance feature.

insert image description here

6-pin LED pin identification method

The following figure shows the pin distribution pattern and internal circuit diagram of a 6-pin LED. It has two groups of 3-pin LEDs.

insert image description here

1.6. Voltage-controlled and flashing LEDs

Voltage controlled LED

LED itself is a current-controlled device, that is, it will emit light when current flows through it. When in use, it needs to be connected in series with a current-limiting resistor of appropriate resistance. For the convenience of use, the LED and the current-limiting resistor are made into one piece, which can be directly connected to the two ends of the power supply when in use, thus forming a voltage-controlled LED. The figure below shows the actual picture and internal circuit of the voltage-controlled LED. The luminous colors of the voltage-controlled LED include red, yellow, green, etc. The working voltage has 6 specifications of 5V, 9V, 12V, 18V, 19V, and 24V. The commonly used one is the BTV series.

insert image description here

Flashing LED

The flashing LED is a special light-emitting device composed of a CMOS integrated circuit and an LED. The following figure shows the actual image and internal circuit of the flashing LED, which can be used for alarm indication and undervoltage and overvoltage indication.

insert image description here

The following figure is a block diagram of the internal circuit of a flashing LED. When using a flashing LED, no other external components are required. As long as an appropriate DC working voltage (5V) is applied to both ends of its pins, it can flash and emit light. The commonly used flashing LED is the BTS series.

insert image description here

2. Single chip microcomputer controls LED

After writing so many introductions to LED, we should have a clear understanding of LED. Now we start to write programs for the microcontroller to control the LED.


2.1. Light up an LED

2.1.1 Program Writing

First, we build a circuit schematic in Proteus 8 Professional as shown in the figure


insert image description here

R1 in the figure is a current limiting resistor to prevent the LED from being damaged due to excessive current.


Then start writing the program. If you have learned C language, you should be able to program easily. If you have not learned it, it doesn’t matter, just copy it first.


#include


sbit LED = P2^3 ; // declaration of bit address, note: sbit must be lowercase, P must be uppercase


void main()  // Any C program must have one and only one main function

{  // {} appear in pairs, indicating the start and end of the program

LED = 0 ;  // The semicolon indicates the end of a statement, "1" indicates a high level, and "0" indicates a low level

[1] [2]
Reference address:Introduction to 51 MCU - Controlling LED Lights

Previous article:Introduction to 51 single chip microcomputer - digital tube
Next article:Introduction to 51 MCU - Use of Proteus 8 Professional

Recommended ReadingLatest update time:2024-11-23 11:26

51 MCU-Invisible Vulnerability
1. Vulnerable code If we follow the writing method mentioned in the previous lesson, we can realize the running light with a timed interval of 50ms. #include reg52.h   #include function.h //See Chapter 6, Lecture 8 for details   void main() {     LED_Init(); //Initialize LED hardware module     EA = 1; //Close the
[Microcontroller]
51 MCU-Invisible Vulnerability
51 MCU Study Notes——13.1DS1302 Real-time Clock Principle
DS1302 Real Time Clock Chip schematic: Pin Diagram: It should be noted that both VCC1 and VCC2 are connected to external capacitors, but the capacity is different. The capacitance value of the normal backup power supply VCC2 is 100 times that of VCC1. This is not difficult to understand. If the power is cut off, V
[Microcontroller]
51 MCU Study Notes——13.1DS1302 Real-time Clock Principle
Working principle of 51 MCU IO port - P0, P1
1. Structure and working principle of P0 port The structure diagram of one of the 8 bits of the P0 port is shown in the figure below:    As can be seen from the above figure, the P0 port is composed of a latch, an input buffer, a switch, a NAND gate, an AND gate and a field effect transistor drive circuit. Loo
[Microcontroller]
Programmable Amplifier Based on 51 Single Chip Microcomputer
Simulation diagram:  Based on digital tube display , it has square wave, sine wave, triangle wave, sawtooth wave amplification function, and the amplification multiple supports 1x, 20x, 30x, and 50x amplification programming #include reg52.h #include intrins.h sbit sbF1 = P2 ^ 0; //Do not amplify sbit sbF20 =
[Microcontroller]
Programmable Amplifier Based on 51 Single Chip Microcomputer
Detailed analysis of the RAM structure of the internal data memory of the MCS-51 microcontroller
Internal data memory lower 128 cells The internal RAM of the 8051 microcontroller has a total of 256 units. These 256 units are usually divided into two parts according to their functions: low 128 units (unit addresses 00H~7FH) and high 128 units (unit addresses 80H~FFH). The figure shows the configuration diagram of
[Microcontroller]
Detailed analysis of the RAM structure of the internal data memory of the MCS-51 microcontroller
8051/2 microcontroller commonly used local communication methods UART, RS485, I2C, SPI 25AA040A read and write E2PROM 4
1. Description PART 3 SPI (SCLK, SDO, SDI) full duplex   SCLK clock, SDO (MOSI) data output, SDI (MISO) data input 8051SPI and I2C also need to use IO simulation There are 4 types of SPI bus transmission: CPOL bit, high level: 1, low level: 0 CPHA bit, edge, read first then write: 0, write first then read: 1 When tr
[Microcontroller]
8051/2 microcontroller commonly used local communication methods UART, RS485, I2C, SPI 25AA040A read and write E2PROM 4
Design of Metal Halide Lamp Controller Using C8051 Single Chip Microcomputer
1 Introduction At present, most lighting equipment still uses traditional energy for lighting. Making full use of solar energy as the energy supply for lighting equipment is of great significance in terms of saving energy and protecting the environment. 2. Overall structure of controller
[Microcontroller]
Design of Metal Halide Lamp Controller Using C8051 Single Chip Microcomputer
Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号