Hello everybody
I'm looking for a way to automate an operation.
The purpose is that every time a user connects a device the program recognizes and enables the com port and consequently all the other functions.
In this way it will not be necessary to search for the port of the connected device or but just connect it
In this case I use an ftdi234xd which as vid / pid has the following values
USB Vendor ID (VID) 0403h
USB Product UD (PID) 6015h
I use the follow macros "scanfordeviceid" for chek the vid/pid "VID_0403h&PID6015h"
the question is, how do I pass the value to the next function ie opencom and then start the communication?
Kind Regards
Automatic Com port Select
-
- Posts: 89
- http://meble-kuchenne.info.pl
- Joined: Wed Dec 02, 2020 10:06 am
- Location: Italy
- Has thanked: 37 times
- Been thanked: 10 times
-
- Matrix Staff
- Posts: 1926
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 501 times
- Been thanked: 686 times
Re: Automatic Com port Select
Hello,
Here's a quick example for you.
Here's a quick example for you.
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
-
- Posts: 89
- Joined: Wed Dec 02, 2020 10:06 am
- Location: Italy
- Has thanked: 37 times
- Been thanked: 10 times
Re: Automatic Com port Select
Hi Ben
I am trying to use the program but it does not detect the com port. This is what I see from device manager
Kind Regards
I am trying to use the program but it does not detect the com port. This is what I see from device manager
Kind Regards
- Attachments
-
- Port_serial.png (73.43 KiB) Viewed 8568 times
-
- Matrix Staff
- Posts: 1469
- Joined: Sat Dec 05, 2020 10:32 am
- Has thanked: 204 times
- Been thanked: 348 times
Re: Automatic Com port Select
Hello Oscar,
I've just tested Ben's program and it seems to be working fine for me. In device manager, I looked for the PID/VID under the "Events" tab for the COM port device (in my case, an Arduino Uno) and I found reference to this: USB\VID_2A03&PID_0043. I modified the search string in the program and it is detected fine when the program is run.
I have noticed that yours shows "VID_0403+PID_6015". Perhaps try that in the search string as in Ben's example a "&" is used instead of a "+". It could be this is because the OS language is different, or it could be because the FTDI device identifies itself in a different way.
I've just tested Ben's program and it seems to be working fine for me. In device manager, I looked for the PID/VID under the "Events" tab for the COM port device (in my case, an Arduino Uno) and I found reference to this: USB\VID_2A03&PID_0043. I modified the search string in the program and it is detected fine when the program is run.
I have noticed that yours shows "VID_0403+PID_6015". Perhaps try that in the search string as in Ben's example a "&" is used instead of a "+". It could be this is because the OS language is different, or it could be because the FTDI device identifies itself in a different way.
-
- Posts: 89
- Joined: Wed Dec 02, 2020 10:06 am
- Location: Italy
- Has thanked: 37 times
- Been thanked: 10 times
Re: Automatic Com port Select
Hello Steve
i tried different combinations but can't find the com port. The id name from windows is VID_0403 & PID_6015.
the device in question is a very popular ft234xd
Kind Regards
i tried different combinations but can't find the com port. The id name from windows is VID_0403 & PID_6015.
the device in question is a very popular ft234xd
Kind Regards
- Attachments
-
- Port_serial.png (81.37 KiB) Viewed 8547 times
-
- Matrix Staff
- Posts: 1469
- Joined: Sat Dec 05, 2020 10:32 am
- Has thanked: 204 times
- Been thanked: 348 times
Re: Automatic Com port Select
You could perhaps search through your registry for "VID_0403" and see what it there. It should be somewhere within "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum"
The "ScanForDeviceID" function in Flowcode calls the Windows API which effectively looks at this registry location for the VID/PID string in the "HardwareID" entries. It then returns the equivalent "FriendlyName" from the same location.
For example, when I tried to detect the Uno, the information was found here:
In there are the following entries, which are used to detect the port:
The "ScanForDeviceID" function in Flowcode calls the Windows API which effectively looks at this registry location for the VID/PID string in the "HardwareID" entries. It then returns the equivalent "FriendlyName" from the same location.
For example, when I tried to detect the Uno, the information was found here:
Code: Select all
Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\VID_2A03&PID_0043\85439303033351216280
-
- Matrix Staff
- Posts: 1469
- Joined: Sat Dec 05, 2020 10:32 am
- Has thanked: 204 times
- Been thanked: 348 times
Re: Automatic Com port Select
I think that explains it. Our code specifically looks within the "USB" enumeration. Unfortunately, it looks like the FTDI device works differently to other virtual COM ports.
-
- Posts: 89
- Joined: Wed Dec 02, 2020 10:06 am
- Location: Italy
- Has thanked: 37 times
- Been thanked: 10 times
Re: Automatic Com port Select
Thanks for the help Steve
I recommend making the function compatible, perhaps in a future update or in the next revision, with these devices because they are very used.
Kind regards
I recommend making the function compatible, perhaps in a future update or in the next revision, with these devices because they are very used.
Kind regards