8-bit LED cycle flashing + external interrupt control LED flashing

Publisher:幸福微风Latest update time:2022-06-20 Source: eefocusKeywords:8-bit Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Schematic

Code

#include

#define uint unsigned int 

#define uchar unsigned char

#define ulint unsigned long int

sbit led=P0^0;

 char time=0;

void delay(uint x) 

{

uint i;

for(i=0;i ;

}

void init_T0()

{

TMOD=0x01;

  TH0=0;

  TL0=0;

  ET0=1;

  TR0=1; 

}

void main()

{

  flying number;     

EA=1;

EX0=1;

IT0=1;

init_T0();

while(1)

{

P1=0x01;

for(num=0;num<8;num++)

{

   time=0;

P1=~(0x01<

while(time<20);

}


}

}

void int0(void) interrupt 0    

{     char i=0; 

while(i<2)

{

led =0;   

delay(10000); 

led=1;

delay(10000); 

i++;

}

}

void timer0(void) interrupt 1

{      

        TH0=0;

        TL0=0;

        time++;

}

Keywords:8-bit Reference address:8-bit LED cycle flashing + external interrupt control LED flashing

Previous article:The timer counts digital tubes to display 0 to 99 (interrupt and query modes)
Next article:Use the printf statement to send a string to the virtual terminal.

Recommended ReadingLatest update time:2024-11-16 13:30

Office lighting: LED has a difficult time conquering
Relevant organizations pointed out that in the current LED lighting market, outdoor lighting and public lighting are the markets where traditional lighting is best replaced with LED lighting. Home lighting and commercial lighting are also gradually on the road to replacement. Office lighting can be said to be a bast
[Power Management]
LED lamps with more than 100 lumens per watt can save up to 70% of energy usage
LED lamps with more than 100 lumens per watt can save up to 70% of energy usage The BetaLED division of Ruud Lighting, Inc., introduces the 304 Series luminaire, the first BetaLED luminaire to reach the milestone performance of over 100 lumens per watt. With over 100 lumens per watt (LPW), the 304 Series lu
[Power Management]
Changing packaging technology greatly improves LED lighting reliability
随着蓝光和白光发光二极管(LED)在1990年大举迈向实用化阶段后,无论是利用LED所进行的全彩显示,或是在近年来社会大众对节能议题所展现的高度重视下,LED所普及到的智慧型手机、个人电脑(PC)、电视背光、照明、白色家电产品或交通号誌等多样化的产品应用领域愈来愈广。为满足市场需求,业界针对各种产品系列,包括能够实现高演色性与高可靠性的照明用LED、以PICOLED为代表产品的小型薄型LED,以及车用客製化色彩LED等倾注了相当的研发资源。    White LED output for lighting grows rapidly   Driven by the world's energy-saving trend a
[Analog Electronics]
Changing packaging technology greatly improves LED lighting reliability
LED backlight design for digital photo frames
  In recent years, the appeal of traditional paper photo frames has gradually faded. With the popularity of digital cameras and mobile phone cameras, the digital photo frame market is booming. Digital photo frames have built-in speakers and headphones, and can achieve moving pictures through MP3 functions. Therefore,
[Power Management]
Design of a high power LED constant current source series driver
引言 随着大功率LED的问世,因其发光效率是一般荧光灯或白炽灯的5~7倍,节能效果十分显著。因而,大功率LED具有广泛的应用前景。目前,单个大功率LED已有1W、3W、5W和10W,已被大量使用的是1W和3W的大功率LED,采用多个大功率LED串联和并联,其组合输出功率已达70W~100W。 大功率LED虽具有发光效率高和节能的优点,但其管压降的不一致却是需要克服的缺点。其次,大功率LED的温度特性较差。随着结温和环境温度的改变,其管子的电流和发光效率变化很大,这也给使用带来了不便。 由于大功率LED存在以上缺点,人们在使用时多采用两种驱动方案:1.恒压源驱动。即采用多个LED并联后用恒压源驱动。这样,由于L
[Power Management]
Next Generation Automotive Exterior Lighting LED Driver Technology Evolution
在电动汽车、ADAS和对现代风格的渴望的推动下,汽车照明正在快速发展。汽车工业继续向电气化转变,导致汽车外部照明发生显著变化。过去,大型单一功能灯控制着车辆的前部、后部或侧面。然而,围绕着汽车的更新、更薄的设计 取代了他们的位置。汽车制造商正在使用灯光作为标志性的造型特征,并加入动画来象征品牌身份。这些新设计不仅美观,而且实用。 Animated taillights are not new as they first appeared on 1960 muscle cars such as the 1965 Chevrolet Impala SS. It featured a unique tailli
[Embedded]
Next Generation Automotive Exterior Lighting LED Driver Technology Evolution
51 MCU simple button (press LED to light up, release LED to turn off)
#include"reg52.h" typedef unsigned char u8; typedef unsigned int u16; sbit l1=P2^3; sbit k1=P3^2; sbit l2=P2^2; sbit k2=P3^3; void delay(u16 i) { while(i--); } void anjian1() { if(k1==0) // Check if the button is pressed { delay(1000); //debounce if(k1==0) //After debounce, determine whether it is pressed again
[Microcontroller]
Analysis on Effectively Improving Heat Dissipation of High-Power LEDs
For a long time, display applications have been the main demand for LEDs. When the heat dissipation requirements for LEDs are not very high, LEDs are mostly packaged using traditional resin substrates. After 2000, with the development of high-brightness and high-efficiency LED technology, coupled with the s
[Power Management]
Analysis on Effectively Improving Heat Dissipation of High-Power LEDs
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号