您好,欢迎访问三七文档
当前位置:首页 > 电子/通信 > 综合/其它 > MCS-96单片机和PC机的串行通讯
:20021113MCS-96PC闫华光(,100085):介绍了MAX232芯片的使用,给出MAX232接口通信电路,以及MCS-96单片机与PC机的串行通信程序设计:单片机;PC机;通信;MAX232:TN492:A:1008-0147(2003)05-50-03SerialcommunicationbetweenMCS-96SingleChipMicrocomputerandPersonalComputerYANHua-guang(ElectricPowerResearchInstituteofChina,Beijing,100085,China)Abstract:Inthisarticle,howtouseMAX232,itsinterfacecommunicationcircuitsandtheprogramdesignofserialcommunicationbetweenthePCcomputerandMCS-96Singlechipmicrocomputerarepresented.Keywords:Singlechipmicrocomputer;PCcomputer;Serialcommunication;MAX2321,PC,MCS-96,,PC()(),,,PL/MVBPL/M,CPU,,,,VB,,,2,RS-232C(),RS232-C25,,31,5Vol.31,No.5MICROELECTRONICTECHNOLOGY153200310RXD,TXDGNDRS232,+3~+150,-3~-151,TTLCMOS,MAX232MAX232MAXIMRS232/EIA-232EV!28/V!24MAX232,+5VRS-232C∀10V,+5VMAX232C1C2C3C4,1F/25VC501FMAX232T1INT2INR1OUTR2OUTTTL/CMOST1OUTT2OUTR1INR2INRS-232TTL/CMOST1INT2INMCS-96TXD;R1OUTR2OUTMCS-96RXDRS-232CT1OUTT2OUTPCRD;R1INR2INPCTDMAX2321/MAX232,1MAX2323,MCS-96,PC31:80C196,9600:,,,1:BAUD-REG=XTAL1#16-1,9600,12MHz:BAUD-REG=12#1069600#16-1=7780C196PL/M:Main:do$noli$ic(80196.PLM)$Liserial-int:procedureinterruptdeclaretestbyte;test=sp-startand60h;if(testand20h)=20hthendo;/**/sbuf=code-send(i-send);i-send=i-send+1;end;end;if(testand40h)=40hthendo;/**/code-rec(i-rec)=sbuf;i-rec=i-iec+1;End;Endserial-int;declare(code-send,code-rec)(8)byte;declare(i-send,i-rec)byte;i-send=0;i-rec=0;ioc1=20h;/*TXD*/baud-rate=77D;/*9600*/baud-rate=80h;sp-con=09h;/*1,*/int-mask=40h;/**/int-pending=00h;/**/5:MCS-96PC51enable;endmain;32PCPCVBVB,,,,VBMSCOMM,MSCOMM.VBX27,,,,8,OnCommPC:Globalcomm-dataAsInteger//Globaldata(1000)AsIntegerGlobalReceive(1000)AsIntegerPrivateSubForm-load()//,MSComm1.Comport=1//1MSComm1.Settings=9600,n,8,1//9600,1,8MSComm1.PortOpen=True//MSComm1.Rthreshold=1//MSComm1.Sthreshold=1//,OnCommMSComm1.Inputlen=0//MSComm1.InBufferSize=128//MSComm1.OutBufferSize=128//MSComm1.InBufferCount=0//MSComm1.OutBufferCount=0//EndsubPublicSubSend-data()//NForI=0tonMSComm1.OutPut=Chr(data(I))NextIEndSubPublicSubMSComm1-OnComm()//OnCommSelectCaseMSComm1.CommEventCaseComEvReceiveReceive(comm-data)=Asc(MSComm1.Input)/Receive(comm-data)Comm-data=Comm-data+1EndselectEndSub4PC80C196,,,,:[1].MCS-96..1999,7[2].PL/M-96..1990,8[3].VisualBasic6.0..1999,7(41),DSPDSK,DSP:[1]DSP,2001[2],,TMS320C6000DSPs,2000[3]TMS320C6200DSP,2002[4]DSK,1998,11[5],,,200152
本文标题:MCS-96单片机和PC机的串行通讯
链接地址:https://www.777doc.com/doc-4679259 .html