3. Light up the first LED

Publisher:BlissfulMomentsLatest update time:2022-04-13 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Understanding the schematic diagram - writing a driver

LED Module:

insert image description here

As can be seen from the figure, the LED anode is connected in series with a resistor (which plays a role in current limiting), connected to VCC, and the cathode is connected to port P2. To light up an LED, the corresponding IO needs to be given a low level (because the anode VCC is equivalent to a high level)


To name a pin:

sbit variable name = address value

(For example, sbit led=P2^0 means that the P20 port is named led, and it cannot be written as P2.0)


program:


#include

sbit led=P2^0; //The first LED light

void main()

{

while(1)

{

led=0; //Set led to low level

}

}


Reference address:3. Light up the first LED

Previous article:4. LED flashing
Next article:2.C51 basic programs and statements

Recommended ReadingLatest update time:2024-11-23 16:09

Design of LCD display driver IP based on NioslI
introduction The NioslI embedded processor is a SOPC solution proposed by Altera. It is a 32-bit embedded processor that users can configure and build at will. Combined with rich peripherals, it can quickly and flexibly build a powerful SOPC system. Altera provides some general IP cores, allowing users to easil
[Power Management]
Design of LCD display driver IP based on NioslI
NandFlash driver ultra-detailed analysis (I)
Today I learned about the NandFlash driver. The hardware operation is very simple, but the driver under Linux is more complicated. It is mainly a problem with the MTD layer. I spent an afternoon to compile a detailed analysis, which only analyzed the function structure and calling relationship. I didn’t look at the sp
[Microcontroller]
Design of full-color LED driving circuit based on HSI model
Light Emitting Diode (LED) is a solid-state semiconductor device that can convert electrical energy into visible light. It can directly convert electricity into light. As the application of LED becomes more and more widespread, the requirements for its driving circuit are also getting higher and higher. Now most occasi
[Power Management]
Design of full-color LED driving circuit based on HSI model
Research on several MOSFET drive circuits
    Abstract: This article introduces and analyzes several relatively simple and practical driving circuits, and provides circuit diagrams, partial simulation waveforms or experimental waves.     Keywords: high frequency drive circuit 1 Introduction Switching power supply has become more and more popular due
[Power Management]
Triple Output LED Driver Drives Common Anode LED Strings
Some multi-string light-emitting diode (LED) modules use a common anode configuration; however, this common anode connection reduces the number of wires between the LED module and its driver from 2N to N+1, where N is the number of LED strings in the module. This article will explain how to drive such a common anode LE
[Analog Electronics]
Motor drives use digital isolators to distance themselves from traditional solutions
Background on Optocouplers and Digital Isolators Optocouplers use light from an LED to transmit data across an isolation barrier to a photodiode. When the LED turns on and off, logic high and low signals are generated on one side of the electrically isolated photodiode. The speed of an optocoupler is directly related
[Power Management]
Motor drives use digital isolators to distance themselves from traditional solutions
Summary of sam9x5 platform construction and rt3070 driver transplantation
............................................................................................................ PC system: Ubuntu 11.10 Linux kernels : 2.6.39 ............................................................................................................ I won't go into details about the RT3070 drive
[Microcontroller]
13. Smart210 serial port driver based on 12 supplement
In the above 12 sections, we have already discussed the settings and operations of the serial port of 2440. Originally, the serial port operations of 2440, 6410 and 210 should be almost the same. When setting up 6410 and 210, we found that the principles of baud rate setting of 6410 and 210 are the same, but a littl
[Microcontroller]
13. Smart210 serial port driver based on 12 supplement

Recommended posts

[Fudan Micro FM33LG0 series development board review] Development board microcontroller printf Chinese and English printing test
ThePINoftheFudanMicroFM33LG0developmentboardspecificationiscovered,somakeanMCUpackageyourself.Inthisway,theFM33LG0pinsareclearataglance. printf()isaformattedoutputfunction,whichisoftenusedtooutputsomeinf
mameng Domestic Chip Exchange
Cadence High-Speed PCB Design Practical Strategy
Thisisabookwrittenbyahigh-speedcircuitdesignanddevelopmentengineerwhohasbeenengagedinthedesignanddevelopmentofawell-knowndesigncompanyintheindustryforalongtime.Thebookintegratestheauthor'sexperience,understand
arui1999 Download Centre
A novice needs help. When drawing PCB manual wiring in AD13.4, why can't I see the trace of the wiring before the wiring is completed?
Anoviceneedshelp.WhendrawingPCBmanualwiringinAD13.4,whycan'tIseethetraceofthewirebeforethewireisdrawn?CanIseethewireonlyafterdrawing?Whatneedstobeset? Notonlythewire(andthearc),itseemsthatallthething
121hhhhhh PCB Design
Limitations of Flash_API for C2000 Series (28335) DSP
TheAPIcan: 1.RuninstaticinternalSARAM 2.ConfigurethecorrectCPUfrequency 3.IntegratetheAPIintotheapplicationaccordingtotheFlash_APIlist 4.InitializethePLLcontrolregisterandwaitforthePLLtolockbeforeusingtheAP
fish001 DSP and ARM Processors
Before using the peripheral modules in STM32, the related clocks must be enabled. Which other modules also need to be enabled?
InSTM32,therelatedclocksmustbeenabledbeforetheperipheralmodulescanbeused.Inadditiontotheso-calledperipheralmodules,whichothermodulesalsoneedtohavetheirclocksenabledbeforeuse? Opencube,clickclockconfigurati
深圳小花 MCU
Share: Detailed explanation of the 2019 e-sports comprehensive assessment questions
Thecomprehensiveevaluationofthe2019NationalUndergraduateElectronicDesignCompetitionhasended,andwehaveinvitedXidianUniversitygraduatestudentLiTianhongtogiveusakeyanalysis. Firstlookatthetitle: Remark: 1
Jacktang Electronics Design Contest
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号