资源描述:
《多线程串行通信实现技术》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、多线程串行通信实现技术SerialportisastandardPC,configurethecommunicationport,followtheRS-232-C(EIA-232-D)standard,widelyusedincomputernetworkcommunications,Dataacquisition,automaticcontrolandotherfields.Althoughtheoperatingsystemsprovideaserialcommunicationprogramminginterface,buttheunderl
2、yinghardware-orientedprogrammingworkAsisstillcomplex.Inrecentyears,wehavedevelopedwhichisbasedonOSI/RMnetworkprototypesystemOSILite[1]ThesystemselectedtheRS-232-Casaphysicallayerstandard,inthedevelopmentprocessunderdifferentoperatingsystem,serialcommunicationprogrammingin-depth
3、research.IfyouomitSpecificmethodstoaccessthedifferencebetweentheserialport,onlyfromthesoftwareduringoperationRelationbetweentherestofthesystem,serialcommunicationprogrammingcanbedividedintotwoKinds:oneisdirectlyembeddedinthemainprogramontheserialportoftheoperationissimple,butba
4、sicallythecodebetweenthedifferentprogramscannotbereused;theotherIsaserialcommunicationprogramtoexecuteconcurrentlywiththemainprogram,thismethodismorecomplicatedprogramming,butitispossibletoprogramaserialcommunicationspackage,whichSerialcommunicationprogrammingarecommoncomponent
5、s.Inthispaper,thelatterintheWindowsprogrammingmethodunderdiscussion,theuseofdevelopmenttoolsisVisualC++6.0.First,therealizationoftheDOS,asareference,andthenanalyzestheWin32programminginterfaceandserialcommunicationsupportmechanisms,FinallyCSerialPortclassimplementationframework
6、anduse.1??DOSprogrammingofserialcommunicationunderDOS,thereareseveralprogramminginterfacestosupportserialcommunication[2,3]:BIOSfunctioncallsINT14H;DOSINT21Hfunctioncalls3and4sub-functionsEnergy;theserialportdevicefiletouseasafileaccessinterface.Asasingletaskoperatingsystem,DOS
7、isnotunderconcurrentprogramminginterface,butinDOS,totheportandinterruptProgramming,whichisthebasisforconcurrentserialcommunication.Usethismethodrequiresanunderstandingoftheserialportregisters,directoperationofportsandcompiledWritingthecorrespondinginterruptserviceroutine.Usingd
8、irectaccesstotheport,andinterrupt-drivengeneralprocess