摘要在多机通信领域.由于单片机具有灵活高效的多机通信功能和价格优势,应用越来越广泛,但由于单片机的收发信号都是TTI电平,驱动能力和抗干扰性有限,实用中常配合其它总线实现互联,RS-485总线就是其中之一。RS-485总线是平衡差分传输,抗干扰性好,最远可传输4000m,可互联多达128个单片机,非常适台组成多机通信系统。在多机通信中,最重要的是保证通信有条不紊地进行,因此需要严格的通信协议和完善的通信软件,本文将重点介绍应用于某大型工程的单片机多机通信协议和通信软件的设计方法。本文介绍一种利用单片机本身所提供的串行通讯口,采用自定义串行通信协议,加上总线驱动器如MAX481、MAX483、MAX485、MAX487等组合成简单的RS-485通讯网络,完成单片机间的多机通讯。关键词:单片机;串行通信;RS-485总线:多机通信协议AbstractIncomputercommunicationfield.Becauseofthesinglechipmicrocomputerhasflexibleandefficientcomputercommunicationfunctionandpriceadvantage,usedmoreandmorewidely,butbecauseofthesinglechipmicrocomputertosendandreceivesignalsareTTIlevel,driveandanti-interferenceabilityislimited,practicalcooperationwithotherbusrealizeinInternet,RS-485busisoneofthem.RS-485busisabalanceddifferentialtransmission,anti-jammingofthegoodandasfaras4000mcouldbetransmitted,interconnectedasmanyas128singlechipmicrocomputer,verycomfortableacompositioncomputercommunicationsystem.Incomputercommunication,themostimportantistoensurethatcommunicationsinanorderlyway,andthereforeneedtostrictcommunicationprotocolandperfectcommunicationsoftware,thispaperwillfocusonintroducesappliedinalargeprojectsingle-chipcomputercommunicationassociationPutthecommunicationsoftwaredesignmethod.Thispaperintroducesamicrocontrolleritselfprovidetheserialcommunicationmouth,usecustomserialcommunicationprotocol,plusthebusdrivesasMAX481,MAX483,MAX485,MAX487combinedintosimpleRS-485communicationnetwork,finishbetweenthesinglechipcomputercommunication.Keywords:SCM;Serialcommunication;RS-485bus:computercommunicationagreement目录第1章绪论........................................................11.1课题研究背景与意义........................................................................................................11.2单片机多机通信发展........................................................................................................1第2章总体介绍....................................................32.1系统组成...........................................................................................................................32.2RS-485...............................................................................................................................32.3多机通信原理...................................................................................................................4第3章硬件设计及原理..............................................63.180C51单片机硬件结构....................................................................................................63.2最小应用系统设计...........................................................................................................73.2.1时钟电路................................................................................................................73.2.2复位电路................................................................................................................83.3总线驱动芯片........................................................................................................