C52和L298制作的寻迹小车(全英文的)_第1页
C52和L298制作的寻迹小车(全英文的)_第2页
C52和L298制作的寻迹小车(全英文的)_第3页
C52和L298制作的寻迹小车(全英文的)_第4页
C52和L298制作的寻迹小车(全英文的)_第5页
已阅读5页,还剩3页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

experiments.BuildasimpletwowheelsrobotwithL293DH-BridgedriverandIRsensors.WriteaCprogramcontrolsrobottrackedwithblacktape.FunwithVing-PeawCompetition2543,courselayout,day-by-daychangedruleandscoringalsoincluded。IntroductionOneofmystudenthasmadeadisgracefulrobotthatusedtwosteppermotorsandwithasimpleIRsensor.Yes,abovepictureiswhatImtalking.Withoutbatterycarrying,alittlebittorqueofthestepperandmisalignmentofdrivingshaft,makesitcrawlingnotwalking,butfirstdemo,showedquiteimpressivetome.HesaidhewroteacoupleofprogramlinesusingC,hisrobotcantracktheblacktape.Ifeeldelightedhisintentionandendeavor.Ithought,"heborrowedmeDS5000,expensiveone,asoftuControllerwithinternalbootloader,whyshouldnttrywithourlearningboardC-52EvaluationBoardinstead".Anotherone,toldmethesameday"IfoundtheL293Push/PullFourChannelDriveratBan-Moah,itcosts1.5US$".Ivebeensearchingthischipforayear.TheMiniBoard,aMotorola68HC11RobotControllerboarddesignedbyFredG.Martin,alsousesthisdriver.Thedayafter,IthendecidedtopreparethepagedescribinghowtouseC-52EVBasarobotcontrollerboard.Iaskedmystudentforcompetition,buildyourselvesrobotthatcantracktheblacktape.Prizeforthewinneris100US$,withabitconditionthatthewinnermustpayforabigpartyatSoiJindasSomtum(PapayaSalad)shop.Andoneofthecompetitorisme.Ithoughttheruleshouldbeconceivedroughlybystudentsandtechnicallybyme.Thepictureonthatdaywillputheresoon.C-52EVBresourcesBeforehand,letlookatavailableresourcesofC-52EVBforrobotexperiments.ActuatorsDCmotorPWMwithtimer2helpsP1.4,P1.5,P1.6,P1.7Sensorsdigital/analogIRdetectorwithcomparatorchip/foranaloginput,seeuseofPIC16C711digitalinput/T0,T1forpulseinputBrainCprogramavailablecodeanddataspaceapprox.32kB8000H-FFFFHProgramDownloaderRunningwithoutmonitorPAULMON2withPAULsstartupheader9600,8n1P3.0(RxD)andP3.1(TxD)DCMotorDriverBasiccircuitofusingL293formsanH-BridgeDriverisshowninFigure1.AsshownforsuchinductiveloadasDCmotor,externaldiodesforsuppressingbackEMFmustbeconnected.TheMiniBoardusesL293Dinstead,theL293Dhasinternaldiodes,howeverprovidingabitlessdrivingcapacity,i.e.,600mA@4.5V-36V.Fromthetruthtable,weseethatdirectionofthemotorcancontrolbypinCandD.VINHenable/disablepowertothemotor,thusforspeedregulation,wethenusethispinforPWMsignaling.Seedetails,L293.pdfdatasheet.Figure1:BasiccircuitofL293formsH-BridgeDriverAcircuitconnectingC-52P1toL293driverchipisshowninFigure2.AsshownEnablepin1connectedtoP1.0isforPWMsignaling.Weuseadditionalinverteratpin7andpin15toprovideproperlogicforeasydirectionalcontrol.Pleasenotethatpin4,5,12,13aretiedtogroundandifheatsinkingneeded,onemethodistomakealargeareaofPCBorsolderingitwithametalsheet,say.Figure2:ConnectingC-52EVBP1.4-P1.7toL293.ExternaldiodesmustbeconnectedforL293(notshownincircuitdiagram).MylatestdesignputadditionalinverterforPWMsignalatpin1andpin9topreventfullpowerdeliveringtoDCmotorswhenresettingthe89C52(i.e.,allbitsofP1islogichigh).CheckthelogicofPWMpinsforanothermicrocontrollers.LineTrackingSensor(IhavetoKUK)SincetheresnoADCfor89C52chip,eachcompetitormaybuildtheirownLineTrackingSensor,somemayuseLM339QUADcomparatorwithIRtransmitterandreceiver,somemayuseLDRasdescribedinLineFollowerRobot.Withanexternalcomparator,itmaynotnecessarytohaveADC,butwithLDR,weneedexternalADC."HavingadditionalADCfor89C52wouldbebetter",Ithought.HowcanweprovideADCfor89C52withacheapmethod?IchosePIC16C711with4-channelADC,and7-pininputport.Interfacingto89C52isdonewithsimplePISOprotocolbyusingRB0forSCLKandRA4forSDA.ThecodeforsuchpurposewaswritteninC,hereisthesourcefile,C52ADC.CandtheHEXcode,C52ADC.HEX.Aftersomeinitialization,the711chipwaitfortriggerreadsignalatpinRB0,i.e.,high-to-lowtransition,thenitresponsesbysending40-bitthroughRA4(SDA)withlow-to-hightransition.40-bitdatastreambeginswithLSBofADC0toMSBofPORTB.ExampleofprogramfrotestingADCisADC.CandthehexfileisADC.HEX.

Figure3:UsingPIC16C711tobea4-channelADCand7-bitinputportforC-52EVB.SimplePowerSupplyandChargerCircuitsFigure4showsasimplepowersupplycircuit.IhavetestedwithKABO,itworksfine.Forthosewhohaveabigcapacityrechargeablebattery,theresistancevalueofRcanbeselectedforapprox.10%outputchargingcurrent.DCincanbehigherifyourbatteryvoltagehigherthan8.4V,say.ToensuretheoutputcurrentiswithinthevaluecalculatedbyR,measureDCcurrentbefore.ThemaximumsupplyforLM317is~35V.Figure4:CircuitDiagramofbatterysupply+12VAlkalineand+8.4VNiMHwithaconstantcurrentrechargercircuit.For~20mA,useR~60Ohms.S1ismainswitchforCPUandL293circuits.UsingPAULsStartupHeaderfilewithMicro-CBeforewritingPWMgenerationfortestingabovecircuit,letstudyhowtousePaulsheader.WithaPAULsstartupheaderatthebeginningoftheapplicationCprogram,aftersuccessfullydownloadingthehexcode,justpressRESET,the89C52thenwillruntheapplicationinsteadofPAULMON2monitorprogram.AslongastheprogramremaininSRAM,runningtheprogramcanonlybedonewithpressingRESET.ToreturntoPAULMON2prompt,turntheboardpoweroffforawhile,thenbackthepoweronagain.ThisconceptofstartupheaderallowsustouseC-52EVBasadedicatedcontrollerbesideasalearningboard.OriginallyPaulhasmadewithentirelyinAssemblycode.However,IhaveadaptedforMicro-CCompiler.Ihaveputtheheaderforstartupcodeinthestartupandruntimelibraryforsmallmemorymodel.ThefileC52ROBOT.ASM,willcompileandlinktothemain()functionwithS=c52robot.asmwheninvokingcommandcoordinator.Exampleofcommandlineis;c:\mc\cc51%1-ilph=c:\mcm=ss=c52robot.asm%1ishello(.c),sayLettryhello.candcompilewithabovecommandline,downloadthehello.hexintotheC-52board,thenpressRESET,seewhathappen?ManualControlProgramdemonstratesPWMgenerationwithKABOOnemethodofdeliveringDCpowertomotorsistousePWM.ThePWMmethodsupplysDCpulsewithfixedfrequencybutwithadjustabledutycycle.IusedTIMER2inAUTOreloadproducing1000HzPWMfrequency.Eachtimeexecutinghasenteringintoserviceroutine,a16-bitPWM1wasshiftedouttoP1.7andPWM2toP1.6.Mainprogramhasataskthatsetthepowerformotor1andmotor2bywriting16-bitPWMpatternintoPWM1andPWM2formotor1andmortor2respectively.Theserviceroutinefortimer2isputinstartupcode.Seeexampleprogram,KABO1.CandC52ROBOT.ASM,forPWMdemonstrationwithmanualcontrol.Ihavedesignedandbuiltmyownrobotforthecompetitionalso.ItnamesKABOhavingdifferentialdrivemethod.Asshowninright-handside,istherarepartpoweredbyC52-EVB.ThemotordriverchipL293Danda74LS04areputatthesolderingpad.

Ving-PeawCompetitionIsupposethereshouldhavetenrobotstobecompeted.DetailsRuleandScoringwillb

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论