NO

Author Topic: FTDI D2XX drivers  (Read 16360 times)

CommonTater

  • Guest
Re: FTDI D2XX drivers
« Reply #15 on: April 29, 2012, 01:32:15 AM »
That's all looking good now. Gives me something to start from, which I always find is the biggest hurdle.

On a separate matter, how do I circumvent the "Do you want to allow the following program from an unknown publisher to make changes to this computer" dialog box that always pops up when I start the Pelles C IDE?

John


You must be on Vista or 7 ...

On Win7 ... Control Panel -> Action Center -> Change UAC settings -> "Never warn".
On Vista ... get used to it.

jboyes

  • Guest
Re: FTDI D2XX drivers
« Reply #16 on: August 01, 2012, 12:24:10 PM »
I am not a Pelles C expert by any means but I do use the IDE and enjoy writing Windows programs. I also write code for PICs and have successfully communicated between PC and PIC without having to call any special drivers from within my code.

I use the CreateFile function and specify "COMx" as the 'file' to open.

Just in case it is of any use to you, I have attached a code snippet of the section I use to identify which ports are available. (I only test up to 9 because higher numbered ports are a bit fiddly and I do not have very many on my PC).

Code: [Select]
:
case WM_INITDIALOG:
:
for (int i = 1; i < 10; i++) {
sprintf(myPort, "COM%d", i);
hCom = CreateFile(myPort, GENERIC_READ | GENERIC_WRITE,
0, // exculsive access to this 'file'
NULL, // Security Descriptor - cannot be passed to child
OPEN_EXISTING, // Required for COM ports
FILE_ATTRIBUTE_NORMAL, NULL);
if ((hCom != INVALID_HANDLE_VALUE) && (GetLastError() != ERROR_FILE_NOT_FOUND)){
SendMessage(hPorts, LB_INSERTSTRING, -1, (LPARAM)myPort); // append to listbox
}
CloseHandle(hCom);
}

My Listbox gets filled with the names of all COM ports that are available. I then open up the one I want and use ReadFile and WriteFile to communicate. Of course the driver for the USB-to-TTL converter has to have been loaded outside of my program but this only has to be done once.

I hope this is relevant and of some use.

John.