Jump to content
    

CreateFile и виртуальный COM порт FT232

Физические порты открываются - оба виртуальных FT232 нет. Подскажите, так должно быть или я где - то ступил? 

 

   HANDLE hComm;
   hComm = CreateFileA("\\\\.\\COM2",                 //port name
                        GENERIC_READ | GENERIC_WRITE, //Read/Write
                        0,                            // No Sharing
                        NULL,                         // No Security
                        OPEN_EXISTING,                // Open existing port only
                        0,                            // Non Overlapped I/O
                        NULL);                        // Null for Comm Devices
   if (hComm == INVALID_HANDLE_VALUE)
       printf("Error in opening serial port\n\n");
   else
       printf("Opening serial port successful\n\n");
   CloseHandle(hComm);//Closing the Serial Port

Если нет, пойду курить FT2xx

Share this post


Link to post
Share on other sites

А чужие терминальные программы работают?

 

Share this post


Link to post
Share on other sites

Может порт занят кем-то, или ты его пытаешься открыт когда он еще не создан? Нужно возвращаемую ошибку глядеть.

https://learn.microsoft.com/en-us/windows/win32/debug/system-error-codes--0-499-

Edited by Andrew_Q

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...