欢迎来到天天文库
浏览记录
ID:55704152
大小:98.00 KB
页数:20页
时间:2020-05-25
《VBA 中使用 API 串口通信 Serial Port (英文).doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、'-------------------------------------------------------------------------------''ThisVBmoduleisacollectionofroutinestoperformserialportI/Owithout'usingtheMicrosoftCommControlcomponent.ThismoduleusestheWindowsAPI'toperformtheoverlappedI/Ooperationsnecessaryforserialcommunicati
2、ons.''Theroutinecanhandleupto4serialportswhichareidentifiedwitha'PortID.''Allroutines(withtheexceptionofCommReadandCommWrite)returnanerror'codeor0ifnoerroroccurs.TheroutineCommGetErrorcanbeusedtoget'thecompleteerrormessage.'-----------------------------------------------------
3、--------------------------'-------------------------------------------------------------------------------'PublicConstants'-------------------------------------------------------------------------------'OutputControlLines(CommSetLine)ConstLINE_BREAK=1ConstLINE_DTR=2ConstLINE_R
4、TS=3'InputControlLines(CommGetLine)ConstLINE_CTS=&H10&ConstLINE_DSR=&H20&ConstLINE_RING=&H40&ConstLINE_RLSD=&H80&ConstLINE_CD=&H80&'-------------------------------------------------------------------------------'SystemConstants'-------------------------------------------------
5、------------------------------PrivateConstERROR_IO_INCOMPLETE=996&PrivateConstERROR_IO_PENDING=997PrivateConstGENERIC_READ=&H80000000PrivateConstGENERIC_WRITE=&H40000000PrivateConstFILE_ATTRIBUTE_NORMAL=&H80PrivateConstFILE_FLAG_OVERLAPPED=&H40000000PrivateConstFORMAT_MESSAGE_
6、FROM_SYSTEM=&H1000PrivateConstOPEN_EXISTING=3'COMMFunctionsPrivateConstMS_CTS_ON=&H10&PrivateConstMS_DSR_ON=&H20&PrivateConstMS_RING_ON=&H40&PrivateConstMS_RLSD_ON=&H80&PrivateConstPURGE_RXABORT=&H2PrivateConstPURGE_RXCLEAR=&H8PrivateConstPURGE_TXABORT=&H1PrivateConstPURGE_TXC
7、LEAR=&H4'COMMEscapeFunctionsPrivateConstCLRBREAK=9PrivateConstCLRDTR=6PrivateConstCLRRTS=4PrivateConstSETBREAK=8PrivateConstSETDTR=5PrivateConstSETRTS=3'-------------------------------------------------------------------------------'SystemStructures'---------------------------
8、----------------------------------------------------PrivateTy
此文档下载收益归作者所有