Here we use 4 wires, but the principle of 3 wires is the same.
The IO port is customized in the program. The one used below is P3^0
#include void main() { while(1) { P2=0xff; //Initialize LED if(P3_0==0) //The sensor detects a flame signal P2=0x00; //LED is fully lit } } wiring: AO: Analog output signal DO: digital output signal This article only uses the digital output signal DO- to connect to P3^0 port, Vcc and Gnd are power supply and ground respectively
Previous article:[51 MCU] Detailed explanation of the initial value calculation of the timer
Next article:C51 MCU writes an external interrupt (entry-level MCU)
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Detailed explanation of intelligent car body perception system
- How to solve the problem that the servo drive is not enabled
- Why does the servo drive not power on?
- What point should I connect to when the servo is turned on?
- How to turn on the internal enable of Panasonic servo drive?
- What is the rigidity setting of Panasonic servo drive?
- How to change the inertia ratio of Panasonic servo drive
- What is the inertia ratio of the servo motor?
- Is it better for the motor to have a large or small moment of inertia?
- What is the difference between low inertia and high inertia of servo motors?
- In three minutes, you can understand the concept and classification of power amplifiers!
- Gate circuits: AND gate, OR gate, NOT gate circuits and examples
- 4 types of electrical energy conversion, let’s take a look
- Summary of the differences between SPMSM and IPMSM
- DSP system design - Why is the DSP with large on-chip RAM more efficient?
- What are the advantages and disadvantages of BMS controlling the positive end of the battery and controlling the negative end?
- A brief summary of the DQ axis in the FOC algorithm
- 【NUCLEO-WL55JC2 Review】——by nich20xx
- Real-time control technology meets the needs of real-time industrial communications - Part 1
- How did I get 296g of energy from Alipay Ant Forest?