1、 毕业设计说明书 单片机多机通信实现 I 单片机多机通信实现 摘要:目前,单片机在多机通信领域应用很广。但研究最多的是上位机与下位 机的通信及多单片机构成的主从式多机通信系统。 本文重点研究了多单片机的平 权式多机通信,使各单片机有相同的权限。 本文从平权式多机通信协议入手,首先设计了具体平权式多机通信协议;主 机通信用按键控制,模拟实际应用中的触发信号输入。对于 1 号单片机,还可通 过液晶实时显示工作状态,初始为主机。在不需置其他单片机为主机的情形下, 本多机通信系统可以作为主从式多机通信系统。 从机通信模式通过串口中断触发 启动, 通信结束即恢复之前的从机状态。 通信过程中, 主机先发送
2、寻址的从机号, 待从机响应后开始通信。通信结束后,主机发送自己的主机号,告知从机。然后 从机发给主机校验字节数据,主机检验错误,检验无误后,作出响应,1 号单片 机液晶会显示,2 号和 3 号单片机收发数据无误后会使 LED 指示灯亮起。其外, 本文研究了可切换双向接口的实现方法。 通过用单片机的一个引脚控制单片机的 串口的连接方式,使其工作在主机模式或从机模式。 本研究已经仿真通过,真实可行。具有一定的检错能力,串行通信的比特率 是 9600bit/s,通信速度较快,且可靠性高。本研究通过硬件电路解决了通信过 程中多单片机争用主机权的问题。 关键词:单片机;多机通信;平权;AT89S52 I
3、I Realization of many SCM communication Abstract:At present, the single chip multi-machine communication in a wide field of applications. However, the most studied is the host computer and lower computer communications and multi-chip microprocessor master-slave multi-machine communication system. Th
4、is paper focuses on a number of single chip multi-machine communication affirmative, so that the MCU has the same permissions. The paper machine from the multi-level communication protocol of the right to start with, first, the specific communication protocol. Host Communication button control, the
5、practical application of simulation in the trigger signal input. For the No. 1 microcontroller, but also through the LCD display working status, the initial for the host. No other single chip set in the case of the host, the multi-machine communication system can be used as master-slave multi-machin
6、e communication system. Communication mode from the machine through the serial port interrupt triggering, communication before the end of the recovery from the machine state. Communication process, the host sends the address number from the machine until the response from the plane after communications. After communication, the host sends its own host number, informed from the machines. And then distributed to the host from the machine check bytes of data, the host test error, test and proved