桂林电子科技大学课程设计说明书课程设计说明书题目:基于MCS51单片机多机通信系统的实现院(系):信息与通信学院专业:电子信息工程学生姓名:吴斌学号:0861130123指导教师:武小年职称:副教授2011年12月3日基于MCS51单片机多机通信系统的实现摘要目前,MCS51单片机在多机通信领域应用很广。研究最多的是上位机与下位机的通第1页桂林电子科技大学课程设计说明书信及多单片机构成的主从式多机通信系统。本文重点研究了主从式多机通信系统和平权式多机通信系统,把主从式多机通信系统与平权式多机通信系统有效地结合到了一起。所谓主从式结构,即在两个单片机中,一个主机负责通信管理,另一个为从机,从机要负责主机的调度与支配。该设计用AT89S52芯片,并用C语言程序来控制AT89S52,使之能实现两个单片机之间的通信。通信方式为单工通信,一个为主单片机,作为发送方,另一个为从单片机,作为接收方。对于两片MCS51单片机,发送方的数据由串行口TXD端输出,接收方的数据由串行口RXD端输入。通信成功时,对应的LED灯会闪烁,表现通信成功。平权式结构,必须从平权式多机通信协议入手,首先设计了具体平权式多机通信协议;单片机通信用按键开关控制,编程实现地址寻址。1号机按下按键,2号机的数码管就会显示数字,每按一次就累加1,显示16进制;反之,2号机按下按键,1号机的数码管也会显示数字,每按一次也累加1,显示16进制。不存在主从机之分,权限是平等的,并且通信的时候,对应的LED灯会闪烁,表现通信正在进行。本文已经仿真通过,真实可行。具有一定的检错能力,串行通信的比特率是9600bit/s,通信速度较快,且可靠性高。关键词:单片机;多机通信系统;主从;平权;AT89S52BasedontheMCS51single-chipmicrocomputercommunicationsystemAbstractAtpresent,MCS51MCUinmultimachinecommunicationdomainapplicationisverywide.Themoststudiedisthepositionmachineandthelowerpositionmachinecommunicationandmultichipmicroprocessormaster-slavemultiprocessorcommunicationsystem.Thispaperfocusesonthestudyofthemasterslavecommunicationsystemandaffirmativetypemulticomputercommunicationsystem,themasterslavecommunicationsystemandaffirmativetypemulticomputercommunicationsystemeffectivelycombinetogether.第2页桂林电子科技大学课程设计说明书Theso-calledmaster-slavestructure,i.e.,intwosinglechipmicrocomputer,ahostisresponsibleforcommunicationmanagement,anotherfromthemachine,frommachineresponsibleforahostofschedulingandcontrol.ThedesignofAT89S52chip,andClanguageprogramtocontrolAT89S52,sothatitcanrealizecommunicationbetweentwosinglechipmicrocomputer.Communicationmethodforsimplexcommunication,amainchip,asthesender,anotherfromthechip,asthereceiver.ForthetwoMCS51singlechipmicrocomputer,thedatafromtheserialportTXDendsoutput,receivingdatafromtheserialportRXDinput.Thecommunicationissuccessful,thecorrespondingLEDlightflashes,performancecommunicationsuccess.Equitystructure,mustfromaffirmativetypemultimachinecommunicationprotocoltostart,firstdesignedspecificaffirmativetypemultimachinecommunicationprotocol;single-chipmicrocomputercommunicationwithkeyswitchcontrol,programmingaddress.Unit1keysarepressed,theNo.2enginedigitalcontrolwilldisplaythenumber,eachtimeincrement1,show16hex;conversely,theNo.2enginepress,machine1digitaltubewillalsodisplaydigital,everytimealsoaccumulated1,show16hex.Thereisnomaster/slavemachinebranch,authorityisequal,andthecommunicationtime,correspondingtotheLEDlightflashes,performancecommunicationis.Thispaperhasbeenadoptedbysimulation,practical.Hasacertainerrordetectioncapability,serialcommunicationbitrateis9600bit/s,communicationspeed,andhighreliability.Keywords:singlechipmicrocomputer;communicationsystem;master-slav...