看板 C_and_CPP 關於我們 聯絡資訊
請問有人用 VC win32api 寫 uart 應用程式嗎? 我遇到一個問題就是我 裝置管理員->系統 有 com1 和 com11 com12 com11 和 com12 是 usb轉rs232 com1 可以開啟來操作, 但是 com11 com12 都不行, 請問有人遇過類似的狀況嗎? 在 Create File 就死了 hCom = CreateFile( pcCommPort, GENERIC_READ | GENERIC_WRITE, 0, // comm devices must be opened w/exclusive-access NULL, // no security attributes OPEN_EXISTING, // comm devices must use OPEN_EXISTING 0, // not overlapped I/O NULL // hTemplate must be NULL for comm devices ); if (hCom == INVALID_HANDLE_VALUE) { // Handle the error. printf ("CreateFile failed with error %d.\n", GetLastError()); return (1); } 錯誤編號 : 2 系統找不到指定的檔案 我開超級終端機可以連上我 uart 另一邊的 device -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.118.20.167
afcajax:用字串"comX"這樣的只能到com9 12/22 21:53
afcajax:要用\\\\.\\comX類似這樣的,正確語法就麻煩google一下吧 12/22 21:54
licheer:另一個方法是改到com9以內 12/22 21:58
clanguage:可以了 感謝 12/23 13:22