您好,欢迎访问三七文档
当前位置:首页 > 行业资料 > 交通运输 > 基于AT89S52单片机控制的智能台灯设计
16201111JOURNALOFSOUTHERNVOCATIONALEDUCATIONVol.1No.6Nov.20112011-09-101982-。1976-。AT89S52510430AT89S52。30cm3。AT89S52TP274A2095-073X201106-0015-05、。。。1220V。POWER/。AUTO/MENU。“AUTO/MENU”MENU“+”“-”30cm3AUTOMENU554m。、1。220V、+15V、+12V、+5V、-12V55540KHz74LS04。TL084LM393C21VR11161LM393MCULEDLED。2。MCUMCUAT89S52、CMOS88KFlash。3。23MCU555AT89S5240KHZ4。TL084LM393。4M=S*t/2MS5。6AT89S52175LEDAT89S52PT4115DIMPWMLEDLED26。6LED、KeilCC。、、。7。7#include<reg52.h>181#defineuintunsignedint#defineucharunsignedcharsbitkey=P2^2sbitkey1=P2^3sbitled=P1^0uintpwm=0x7fvoiddelaymsuintxmsvoiddelayuinttvoidmainTMOD=0x21TH0=0xfcTL0=0x66TH1=pwmTL1=0EA=1ET0=1ET1=1TR0=1while1doifpwm=0xffpwm++delayms10whilekey==0doifpwm=0x02pwm--delay10whilekey1==0voidtime0interrupt1TR0=0TH0=0xfcTL0=0x66TH1=pwmTR1=1led=1voidtime1interrupt3TR1=0led=0voiddelaymsuintxms//xmsuintijfori=xmsi>0i--forj=123j>0j--voiddelayuchartwhilet--。8。8voidPWM_SetuintHzucharDifD>1006AT89S5219D=100Hz=1000000/HzHigt=65536-D*0.01*HzLow=65536-100-D*0.01*Hzvoid_TIME1_voidinterrupt3//1PWMEA=0TR1=0PWM=PWMifPWMTH1=Higt>>8TL1=HigtPWM=1elseTH1=Low>>8TL1=LowPWM=0ifflag==3sm+=1ms+=1TR1=1EA=140KHZMCU3。、。PWM。、。。。45。30。1.BISS0001J.2010924-26.2.AT89S52J.20091118-19.3.M.200535-40.AT89S52MicrocontrollerBasedControlofIntelligentDesignLampZHANGRen-chaoLIUJin-longGuangzhouInstituteofRailwayTechnologyGuangzhou510430ChinaAbstractThispaperamicrocontrollerAT89S52-basedintelligentcontroloftheultrasonicranginglampdesign.Itisbasedonreadinglampnexttosomeoneandtheintensityoflightfromthelineofcontrollampoffandonandtheuseofultrasonicsensorsmeasuresthedistancebetweentheuserandthelamp.Whenthedistanceislessthan30cmbycontrollingthelightflashingtheuserisremindedtokeepthedistancewiththelampsoastoprotecteyesightandcorrectposture.KeywordsAT89S52ultrasonicwaveintelligentlampdesign
本文标题:基于AT89S52单片机控制的智能台灯设计
链接地址:https://www.777doc.com/doc-4935651 .html