PC机与RS485总线多机串行通信的软硬件设计陈铁军,谢春萍(537000):详细介绍了基于RS485总线的PC和多单片机的串行通信方法,讨论了总线接口转换主从式通信协议设计方法,并给出了采用中断方式处理的通信过程流程图同时还提出了差错控制以及硬件设计中总线隔离失效保护电磁干扰等几个要注意的问题及解决方法在多媒体网络广播系统中采用上述方法,取得了良好的效果:PC;单片机;串行通信;RS485:TP302:B:1004373X(2007)0510303DesignofSoftwareandHardwareinSeria-lCommunicationbetweenPCandMultipleMCUsBasedonRS485CHENTiejun,XIEChunping(YulinNormalUniversity,Yulin,537000,China)Abstract:ThecommunicationbetweenPCandmultipleMCUsbasedonRS485isdescribedindetailinthearticle.Thebusinterfaceconversionandthedesignofmaster-slavecommunicationprotocolisintroduced.Theprogramflowchartofcommun-icationwithinterruptprocessisgiven.Thearticlealsodescribessomeimportantproblemsforhardwaredesign,thenitprovidesthemethod,suchaserrorcontrol,businsulation,invalidationprotectionandelectromagnetisminterfere.Theauthorsusethea-bovetechnologyinthemultimedianetworkbroadcastsystemeffectively.Keywords:PC;singlechip;serialcommunication;RS485:200609151,,RS485,RS485,,RS485SN75276,SN75LBC184,MAX485,MAX1480,MAX1487,MAX3082MAX1483RS485:,;;10mA/-08mA(12Vin/-7Vin);32(UL);10Mb/s;12192m(4000ft)RS485,,,,,,PC22.1PC与RS485总线的接口PCRS232USB,RS232RS485,RS485RS485,TTLRS485,,MAX485PCRS232,RS232/485S2-485RS2329,RS485,12.2RS485方式构成的多机通信,PC,:,,PC;,,,RS485,2,,,10320075244,A+B-10k;B-10k,,A+32V,B-16V,,0,图1系统总体连接框图图2多机通信原理框图33.1通信协议设计,,,3:,,;,PC,,,,,,,,192kb/s,SM21,,,,,SM2,,;SM2,,3图3多机通信流程图3.2多机发送时的分时说听,,RS485,485,,,,,,RS485,,,,,,:(1),(2)RE,DE(3),,,,3.3差错控制,,,104:PCRS485;3,,,,,;,,,,3,3,,,,,,N,2N,,,;,,,,,44.1总线隔离RS485,,VA,VB4~10PTC,5VTVS,,,4.2失效保护RS485200mV,:200mVUART0,UART,200mV,,,(200mV),-200mV/-50mV,MaximMAX3080RS485,,4.3电磁干扰问题,(),,,,RS485,,VGPD(),,,,,,,3:(1),,(2),,(),,,(3),,,,,5RS485,,PC,参考文献[1],,.RS485[J].,2002,21(8):41-43.[2],.[M].:,2004.[3],.RS485[J].,2002,19(5):65-67,70.[4],,.[M].:,2003.陈铁军男,1966年出生,湖北襄樊人,玉林师范学院,高级工程师研究方向为嵌入式系统谢春萍女,1980年出生,广西玉林人,玉林师范学院,助教研究方向为单片机应用10520075244