Rev 3455 Rev 3589
Line 7... Line 7...
7 // 7 //
8 // 8 //
9 // History: 9 // History:
10 // 10 //
11 // 1.00 2014_01 Start 11 // 1.00 2014_01 Start
-   12 // 1.01 2014_03 Wait at the end of the program
12 // 13 //
13 // 14 //
14 // Purpose: 15 // Purpose:
15 // 16 //
16 // List all FTDI serial com port chips found in Windows system with theirs com port numbers. 17 // List all FTDI serial com port chips found in Windows system with theirs com port numbers.
Line 30... Line 31...
30 // Set static linkage Project Properties / Configuration Release / Configuration Properties 31 // Set static linkage Project Properties / Configuration Release / Configuration Properties
31 // / Code Generation / Runtime Library = Multithreaded (/MT) 32 // / Code Generation / Runtime Library = Multithreaded (/MT)
32 // 33 //
33   34  
34 #define YEAR "2014" 35 #define YEAR "2014"
35 #define VERSION "1.00" 36 #define VERSION "1.01"
36   37  
37   38  
38 // Library Definitions 39 // Library Definitions
39 // ------------------- 40 // -------------------
40   41  
41 #include <stdio.h> // Standard IO (printf, ...) 42 #include <stdio.h> // Standard IO (printf, ...)
-   43 #include <conio.h> // Windows _getch
42 #include <windows.h> // Windows Console Application 44 #include <windows.h> // Windows Console Application
43 #include "lib_win32\ftd2xx.h" // FTDI Library 45 #include "lib_win32\ftd2xx.h" // FTDI Library
44   46  
45 // Link with library 47 // Link with library
46 #pragma comment (lib, "lib_win32/ftd2xx.lib") // Add this file to Resources 48 #pragma comment (lib, "lib_win32/ftd2xx.lib") // Add this file to Resources
47   49  
48   50  
-   51 void waitforkey()
-   52 {
-   53 printf("\nPress any Key ...\n");
-   54 _getch();
-   55 printf("\n");
-   56 }
-   57  
-   58  
49 // Main 59 // Main
50 // ---- 60 // ----
51   61  
52 int main(int argc, char *argv[]) 62 int main(int argc, char *argv[])
53 { 63 {
Line 73... Line 83...
73 fprintf(stderr, "\nFTDI: Error Reading Library Version\n"); 83 fprintf(stderr, "\nFTDI: Error Reading Library Version\n");
74   84  
75 // Create Device Information List 85 // Create Device Information List
76 DWORD numDevs = 0; 86 DWORD numDevs = 0;
77 ftStatus = FT_CreateDeviceInfoList(&numDevs); 87 ftStatus = FT_CreateDeviceInfoList(&numDevs);
78 if (ftStatus == FT_OK) 88 if (ftStatus == FT_OK && numDevs>0)
79 printf(" Devices Found %d\n", numDevs); 89 printf(" Devices Found %d\n", numDevs);
80 else 90 else
81 printf(" No FTDI Device Found\n"); 91 printf(" No FTDI Device Found\n");
82   92  
83 if (numDevs==0) 93 if (numDevs==0)
-   94 {
-   95 waitforkey();
84 return -1; 96 return -1;
-   97 }
85   98  
86 // List All FTDI Devices 99 // List All FTDI Devices
87 FT_HANDLE ftHandleTemp; 100 FT_HANDLE ftHandleTemp;
88 DWORD Flags; 101 DWORD Flags;
89 DWORD ID; 102 DWORD ID;
Line 122... Line 135...
122 printf(" Com Port com%d", comPortNumber); 135 printf(" Com Port com%d", comPortNumber);
123 } 136 }
124 FT_Close(ftHandle); 137 FT_Close(ftHandle);
125 } 138 }
126 } 139 }
127 printf("\n\n"); 140 printf("\n");
128 } 141 }
129 } 142 }
-   143 waitforkey();
130 return 0; 144 return 0;
131 } 145 }