外文翻译RS232串行通讯.docx
- 文档编号:8593816
- 上传时间:2023-02-01
- 格式:DOCX
- 页数:9
- 大小:24.91KB
外文翻译RS232串行通讯.docx
《外文翻译RS232串行通讯.docx》由会员分享,可在线阅读,更多相关《外文翻译RS232串行通讯.docx(9页珍藏版)》请在冰豆网上搜索。
外文翻译RS232串行通讯
外文翻译
系别
信息工程系
专业
测控技术与仪器
班级
B141401
学号
B14140124
姓名
王文站
指导教师
孙丽媛
负责教师
刘剑
沈阳航空航天大学北方科技学院
2015年6月
TheDesigningofSerialCommunicationBaseonRS232
Abstract-ThisPaperdiscussedtheprincipleofserialcommunicationmainly,proposedthedesignmethodbasedonRS232,designedthehardcircuitofserialcommunication,andrealizedtheprogrammingtoPCMicrocomputerandsinglechipmicrocomputerbyusingassemblylanguageandC++BuilderseparatelyKeywords-serialcommunication;singlechipmicrocomputer;programdesignI.INTRODUCTION
Duringworkinginthecontrolsystem,thePCmicrocomputersendsinstructionsforstep-by-stepmotortocollecttheimageinformation.ThereforethecommunicationbetweenthePCmicrocomputerandthedrivingsystemisneededforthecommunicationsystem.Ingeneral,acompletecommunicationsystemconsistsoftransmitter,receiver,convertingthedatainterfaceandtransmittingdatachannel.Thecontroloftnestep-bystepmotorisrealizedthroughthepulsedistributionbysinglechipmicrocomputer.Onthemotorcontrolsystem,thePCmicrocomputeriscalledasuppercomputer,andthesinglechipmicrocomputerfordrivingstep_by_stepmotoriscalledaslowercomputer.Thecommunicationbetweentheuppercomputerandthelowercomputerhastwomethods,thatsitosaytheparallelinterfacecantransmitmuchdataatthesametimeand
hasthefastspeed,butwhenthetransmissiondistanceisfarandthenumberofdataismuch,itneedsmorethenumberoftransmissionlines.Inaddition,thevoltagelevelmaybechangedbythetransmissionlinefactorandelectromagneticinterference.Serialcommunicationisutilizedinthecontrolsystemsoastosimplifythehardwareandsavethecost..
II.THEBRIEFDESCRIPTIONOFSERIALPORTCOMMUNITION
Serialcommunicationisthecommunicationbetweensenderandreceiverdataline,tomoveeachtimeabit.Theadvantageisthatonlyapairoftransmissionlinestosendinformation,soitslowcost,suitableforlong-distancecommunication;itsdisadvantageisthattransmissionspeedislow.
Serialcommunicationwithasynchronouscommunicationandsynchronouscommunicationaretwobasicmeansofcommunication.Synchronouscommunicationforthecaseofhightransmissionspeed,thehardwarecomplexity.Theasynchronouscommunicationusedintransmissionspeedbetween50and19200baud.Transmissionisrelativelycommon.Inasynchronouscommunication,dataistransmittedframebyframe,eachframeofserialdataformatbyastartbit,5to8databits,aparitybit(optional)andaStopbitoffourparts.Beforetheserialcommunication,thesenderandreceivertoagreethespecificdataformatandbaudrate(communicationprotocol).PC-programmableserialasynchronouscommunicationcontroller
8250toimplementasynchronousserialcommunication.By8250theinitialprogramming,youcancontrolserialdatatransmissionformatandspeed.InthePC,ingeneraltherearetwostandardRS-232CserialinterfaceCOM1andCOM21MCS-51serialmicro-controllerchipincludesafull-dupleserialinterface,canalsoberealizedbyprogrammingtheserialcommunications.CMOSsmartsensorIChasreceivedwideapplicationforlowcost,miniaturization,intelligenceandstandardization.InsmartsensorICdesigns,thecommunicationinterfacecircuitsalsoplayanimportantroleotherthansensorsandsignalprocessingcircuits.Therearemoreserialcommunicationstandardinterfaces,suchasRS-232,RS-485,USBInterface,IEEE-1394,whichhasitselfgoodfeaturesandalsohasfocusedonareasofapplication.RS-485hasaanti-noisecapacitytransmittingdata,soitiscommonlyusedinindustrialproduction.USBinterfaceandIEEE-1394havefastspeed,butsomecomputersandoperatingsystemsdonotsupportsuchinterfaces.RS-232CstandardisaprotocolofasynchronousserialcommunicationandhasbeenwidelyusedinPCandcommunicationindustries.ManyshortdistancecommunicationalperipheralsofPCsuchasprinters,disksandterminalsallcommunicatewithPCviaRS232serialinterface.
RS-32Cstandard
RS-232CistheAmericanElectronicsIndustryAssociation(EIA)formallyannounced,intheasynchronousserialcommunication,themost
widelyusedstandardbus.ThestandardforDCEandDTEserialbinarycommunicationbetweenthemaximumdatatransferrateofupto19.2kbps,thelongesttransmissioncablesupto15metersRS-232Cstandarddefinesthe25-lead,two-waycommunicationingeneral,justSerialinputRXD,serialoutputTXDandgroundGND1RS-232Cstandardlevelsusingnegativelogic,theprovisionsof+3V~+15Vatanylevelbetweenalogic”1”level,withTTLandCMOSlevelsaredifferent.IntheinterfacecircuitandcomputerinterfacechipinthemostlylevelTTLorCMOS,sothecommunication,theneedforlevelconversion,sowithRS-232Cstandardlevelmatching1MAX232chiplevelconversioncanbedoneinthiswork.RS-232isdefinedasthesingle-endedstandards,whichhasmuchcharacteristic,suchasmorecommunicationdistanceinalow-speedserialcommunication,moderatepriceandgoodpracticallyofthesystem,soitismostappropriatetobeacommunicationport.RS-232isanessentialmoderncomputerinterface,itincludesportsCOM1andCOM2,theportCOM1has9-pinconnector.Thenewgenerationcomputerhasa9-pinconnector(DB9)soastoconnectwiththeRS-232communicationport.Inordertoachievereliableandrealtimetransmission,thesystemadoptathree-wireconnectionmethod,thatistosaythattheGNDpin,RXDpinandTXDpinofRS-232portisconnectedwiththeexternalport,itisshowninFigure1:
III.THESOFTWAREDESIGNOFSERIALPORTCOMMUNICATION
ThecommunicationprogramofthesinglechipmicrocomputercommunicationswithPCcomputerbyinterruptandPCcomputeriscalledasmaincontroller.WhenthesinglechipcomputerreceivesthedatasinglessentbyPCcomputer,thenitcallsinterruptserviceprogram.TheflowchartoftheinterruptservicemainsubprogramisshowninFigure3.InordertofullyexploittheefficiencyofsinglechipcomputertominimizeCPUtimeoccupiedbycommunication,thecontrolprogramwillbewewillpromptlyrespondtoandcontrolobjects.Thecommunicationprogramwillbeoptimized.Thesubprogramofserialportinterruptforreceivingdata,thesubprogramforsendingstep-by-stepimpulse,thesubprogramforjudginginstructionandthesubprogramfoesendingdata.A.Thesubprogramofserialp;Thesubprogramofserialpor;B.Thesubprogramofsending;Usingcounter-timerofthes;Thetime0beginstocountfro;C.Thesubprogramsofjudgin;Theprogramofjudginginstr;D.The
A.Thesubprogramofserialportinterruptsforreceivingdata
ThesubprogramofserialportinterruptforreceivingdataismainlyresponsibleforreceivingdatasendbyPCmicrocomputerandstoringthedataintoallocatedmemory(itdoesnotdealwithdatasoastoreducethetimetakenupbyinterruptions).Thedatareceivedbythesinglechipmicrocomputerincludeslittleinformation,suchasspeed,stepsandon/offinstructions,andthebuffersislargeenoughtosendthecomputer,sothesoftwareshakehandsprotocolisomitsoastoraisestheCPUutilization.Whentheprogramofserialportinterruptreceivesthespecifieddata,itexitstheserialportinterrupt.
B.Thesubprogramofsendingthestep-by-stepimpulse
Usingcounter-timerofthesinglechipmicrocomputertime0,asthefixedtimescomplete,thep1.5portisnegatedsoastoperiodicallygeneratethedrivingpulses.
Thetime0beginstocountfrominitialvaluewhichto65535,thentheinterruptsub-programoftimer0iscalled,inwhichthep1.5portisnegatedtogenerateadrivingpulse.Meanwhile,thesinglechipmicrocomputerloadsagaintheinitialvaluewhichissendbythePCmicrocomputerbyserialcommunication.
C.Thesubprogramsofjudginginstruction
Theprogramofjudginginstructionissetontheserialportinterruptprogramtobecalled.ThePCmicrocomputersendsdatatothesinglechip
microcomputer.Afterthesinglechipmicrocomputerreceivesdata,itsetstheRIhigherandcalledtheserialportinterruptsub-program,inwhichthefirstdataisprocessed.Ifthefirstdataisadigitalsymbol“48”,theserialportinterruptsub-programsetsP1.4higher,thenthenextfivebytesdataisusedtoensurethestep-by-stepmotor?
speedandsteps.Ifthefirstdataisadigitalsymbol“49”,itmeansthatthestep-by-stepmotorreverses,thenthesinglechipmicrocomputerreceivesthespeedandstepsinformation.Otherwisethesinglechipmicrocomputerjudgesthatthereceiveddataisnot“STOP”instruction,ifso,itsends“stop”instructiontothedrivesystem;ifnot,itquitstheinterrupt.
D.Theprocessingsubprogramofsendinterrupts
Theprocessingsubprogramofsendinterruptsisresponsibletosenddatatothecomputer,sendinginterruptstateisoffinthegeneral.WhenthecommunicationprogramcompletelydealswithdatawithdatasentbyPCmicrocomputer,thesymbol“1”canbewrittentosendbuffer.Asthecomputerreceivesthesymbol”1”,itissaidthatsinglechipcomputerexecutescompletelytheintroductionsentbyPCmicrocomputer.Thereforetheserialportinterruptissetas“off”statebythesinglechipmicrocomputeranditisset“on”stateagainafterdataaresent.Sothesinglechipmicrocomputerreturnstomainprogramandwaitsforreceivinginstructions.
IV.THEDESIGNOFCOMMUNICATIONPROGRAMOFPCMICROCOMPUTERANDSINGLECHIPMICROCOMPUTER
Inordertorealizethesystemsoftwareeasilygraftedanduniformity,theprogramofuppercomputerisdesignedusingtheBolandC++Builder5.0asaprogrammingtoolinthecontrolsystem?
stheBolandC++Builder5.0asaprogrammingtoolforPCprogramming.Theserialportcommunicationcanbeutilizedintwoways:
First,registercomponents,C++Builderdoesnotinitselfprovideaseparateserialcommunicationcomponent,butitcanbeobtainedthrough
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 外文 翻译 RS232 串行 通讯
![提示](https://static.bdocx.com/images/bang_tan.gif)