Flowing light based on AT89c51 microcontroller, interrupt timing, button control

Publisher:runaway2000Latest update time:2022-01-15 Source: eefocusKeywords:AT89c5 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Interrupt

The timer is the most basic functional device of the 51 single-chip microcomputer, and it is very important to master its programming method;


#include

#include


unsigned char n=0,f=0,s=0;

 

void main()

{

 TMOD=0X61;

   TH0=(65536-9216)/256;

   TL0=(65536-9216)%256; initialize the timer

 TH1=156;

 TL1=156;

 IT0=1;

 EX0=1;

 EA=1;

   T1=0;

 while(1)P1=s;


void Timer0() interrupt 1                

{

   T1=1;

   TH0=(65536-9216)/256;

   TL0=(65536-9216)%256;

   T1=0;

}

void Timer1() interrupt 3  

{

   s++;

}


void interrupt1(void) interrupt 0

{

 if(f==0){

           TR1=1;TR0=1;

           ET1=1;ET0=1;

           f=1;

          }

else if(f==1)

  {

   TR1=0;TR0=0;

   ET1=0;ET0=0;

   f=0;

   }

 

 }


Keywords:AT89c5 Reference address:Flowing light based on AT89c51 microcontroller, interrupt timing, button control

Previous article:Two-phase stepping motor control system based on 51 single chip microcomputer
Next article:Proteus simulation of 8255 parallel I/O expansion experiment based on 51 single chip microcomputer

Recommended posts

【Follow me Season 2 Episode 4】 Mission Memo
EventHomePage HerearethepartsIboughtforthisevent: Theslightlyembarrassingthingisthatthebuzzerinterfacedoesn'tseemtobecompatiblewiththe2.54Dupontline,soitmaynotbeveryconvenienttouseabreadboard.Irealize
eew_kTvRL7 DigiKey Technology Zone
AC Servo System Design Guide
Thisbookaimstoguidedesign.Itstartswithservomotorsandtheirmodels,andthengraduallyexpandstomaincircuits,PWMdrivecontrol,currentandpositionsensors,closed-loopcontrolstructures,andthentocontrolstrategies,controlalgor
arui1999 Download Centre
[Program source code] Freescale MAPS-K64 development board program example
TodayIwouldliketosharewithyoumyprogramexamplesonFreescaleMAPS-K64developmentboard. FreescaleMK64FN1M0VLQ12microcontrollerfeatures: BasedonARMCortex-M4processor,120MHzmainfrequency,integratedDSPinstructions,FPU
annysky2012 NXP MCU
Scaling of DSP data
DSPfixed-pointarithmeticoperation 1Numbercalibration Infixed-pointDSPchips,fixed-pointnumbersareusedfornumericalcalculations,andtheiroperandsaregenerallyrepresentedbyintegers.Themaximumrepresentationrangeofanintegerd
fish001 DSP and ARM Processors
Qorvo breaks power barrier with 10W Ka-band GaN amplifier
Qorvo,Inc.,aleadingproviderofcoretechnologiesandRFsolutionsformobile,infrastructureanddefenseapplications,todayannouncedthelaunchofanMMICpoweramplifierthatdeliversover10wattsofsaturatedpowerinthe32-38GHzfre
Jacktang RF/Wirelessly
Embedded Qt-Table Usage Test
ThisarticleintroducestheuseoftablecomponentsinQt,whichrequirestheuseofQTableWidget. Let'sintroduceQTableWidgetthroughanexample.Thefollowingfigureshowsthetesteffectofthetable. 1QTableWidget QTableWidgetisata
DDZZ669 ARM Technology
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号