摘要小局域网多机通信在如食堂刷卡收费管理系统、汽车加油刷卡系统、电能运输秒表管理系统等领域应用广泛。因此,开展本领域的研究有较好的应用前景。本文主要采用一种以PC机作为上位机,多台80C51单片机作为下位机,来进行上位机与下位机以及下位机与下位机的通信的研究。主要包括:系统总体方案设计;在PC机端,通过专用的RS232/485标准转换芯片S2-485将RS-232电平转换成RS-485电平,在80C51单片机端,通过MAX485转换芯片将TTL电平转换成RS-485电平,来实现上位机与下位机以及下位机与下位机的通信;在系统硬件设计的基础上,制定了通信协议。为了达到使传输数据的准确性,开展了数据传输的错误检查与纠正,以及系统可靠性方面的研究;进行了PC机与下位机,以及下位机与下位机的软件编程、程序调试,实现了系统多机通信的数据传输。关键词:PC机;单片机;RS-485;数据传输;多机通信AbstractMulti-machinecommunicationshaveawiderangeofapplicationsinsmalllocalnetwork,suchasmanagementsysteminthecanteenforchargesofcreditcard,inthegasstationforrefueling,inthetransportofenergyforstopwatchtiming.Therefore,therearegoodprospectstocarryoutresearchinthisarea.Thisarticleusespcmachineasahostcomputerandmultiple80C51single-chipsasslavemicrocomputerstocarryoutthestudyofcommunicationsbetweenPCandlowermachine,aswellaslowermachines.Thearticleincludesanoveralldesigningplan.IntheportofthePC,usingaS2-485,dedicatedRS232/485converterchip,convertstheRS-232levelintotheRS-485level.Intheportof80C51single-chip,MAX485willbeusedtoconvertTTLlevelintoRS-485level.Inthisway,communicationscanbeachievedbetweenPCandlowermachine,aswellaslowermachines.Inthebasisofhardwaredesign,thecommunicationalprotocoliscarriedout.Inordertoachievetheaccuracyofthedatatransmission,theerrorcheckingandcorrectionisimplemented,aswellasthestudyofreliability.Aftersoftwareprogrammingandprogramdebugging,thesystemcanachievedatatransmissionbetweenPCmachineandsingle-chip,aswellassingle-chips.Keywords:PCMachine;Single-chip;RS-485;DataTransmission;Multi-machineCommunication目录摘要..................................................................................................................................................................IABSTRACT.........................................................................................................................................................II第一章绪论.........................................................................................................................................................11.1引言.....................................................................................................................................................................11.2研究的背景及意义........................................................................................................................................11.3论文的主要内容.............................................................................................................................................2第二章多机通信基础...................................................................................................................................32.1数据通信基础..................................................................................................................................................32.2异步串行通信接口标准...............................................................................................................................52.3通...