資源描述:
《多線程串行通信實現(xiàn)技術》由會員上傳分享,免費在線閱讀,更多相關內(nèi)容在行業(yè)資料-天天文庫。
1、多線程串行通信實現(xiàn)技術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