Moteur de recherche de fiches techniques de composants électroniques
  French  ▼
ALLDATASHEET.FR

X  

AN197 Fiches technique(PDF) 9 Page - Silicon Laboratories

No de pièce AN197
Description  SERIAL COMMUNICATIONS GUIDE FOR THE CP210X
PDF  14 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
Fabricant  SILABS [Silicon Laboratories]
Site Internet  http://www.silabs.com
Logo SILABS - Silicon Laboratories

AN197 Fiches technique(HTML) 9 Page - Silicon Laboratories

Back Button AN197 Datasheet HTML 5Page - Silicon Laboratories AN197 Datasheet HTML 6Page - Silicon Laboratories AN197 Datasheet HTML 7Page - Silicon Laboratories AN197 Datasheet HTML 8Page - Silicon Laboratories AN197 Datasheet HTML 9Page - Silicon Laboratories AN197 Datasheet HTML 10Page - Silicon Laboratories AN197 Datasheet HTML 11Page - Silicon Laboratories AN197 Datasheet HTML 12Page - Silicon Laboratories AN197 Datasheet HTML 13Page - Silicon Laboratories Next Button
Zoom Inzoom in Zoom Outzoom out
 9 / 14 page
background image
AN197
Rev. 0.6
9
7.2. Windows 98 SE
Alternatively, to find the port number in Windows 98 SE the corresponding key listed above needs to be opened.
This is also done using several registry calls using Windows API functions. This key is not directly entered using
the VID, PID, and serial number. Instead, each time a new device appears it is enumerated and stored in the
registry. So two lookups have to be performed: one to determine if the current key in question contains the VID, PID
and serial number needed, and another to actually determine the port number if the VID, PID, and serial number
match from the previous lookup. The function is passed the VID, PID, and serial number, and the return value is
either the port number that the CP210x is located on, or a –1 if there is a failure. Here is the function to find the
CP210x port number in Windows 98 (this function can be copied straight into application code that needs to
discover the COM port number):
int GetPortNum98(WORD vid, WORD pid, char* ser)
{
// Variables used for Registry access
HKEY tmpKey;
CString portKeyString, serKeyString;
int serialIndex;
DWORD valtype;
char* portString;
DWORD length = 100;
portString = new char[101];
// Set portnum to -1, so if there is an error we will
// know by returning a negative port value
int portNum = -1;
// We will search through the keys by index, starting at 0
// Use this index in the key "Enum\SLABCR\guid\XXXX"
serialIndex = 0;
serKeyString.Format("Enum\\SLABCR\\guid\\%.4d", serialIndex);
// Loop through and convert the serial string to all upper case and replace spaces
// for Win98
int i = 0;
while (ser[i] != '\0')
{
if (ser[i] == 0x20)
ser[i] = '_';
else if ((ser[i] >= 0x61) && (ser[i] <= 0x7A))
ser[i] -= 32;
i++;
}
// The portkey string should look like this when we query the CLowerDeviceID
// "USB\VID_XXXX&PID_XXXX&MI_00\\XXXX_00" where the XXXX's are Vid, Pid and serial
// string
portKeyString.Format("USB\\VID_%04X&PID_%04X&MI_00\\%s_00", vid, pid, ser);
//
Open keys to get to the key where the port number is located. This key is:
//
HKLM\Enum\SLABCR\guid\XXXX\Portname is the key and we will loop through each key
// in the registry
while (ERROR_SUCCESS == RegOpenKey(HKEY_LOCAL_MACHINE, serKeyString, &tmpKey))
{
// Determine the status of the call
DWORD status = RegQueryValueEx(tmpKey, "CRLowerDeviceID", NULL, &valtype,
(unsigned char *)portString, &length);



Html Pages

1 2 3 4 5 6 7 8 9 10 11 12 13 14


Fiches technique Télécharger

Go To PDF Page


Lien URL



ALLDATASHEET vous a-t-il été utile ?  [ DONATE ] 

À propos de Alldatasheet   |   Publicité   |   Contactez-nous   |   Politique de confidentialité   |   Lien vers la fiche technique    |   Echange de liens   |   Fabricants
All Rights Reserved©Alldatasheet.com


Mirror Sites
English : Alldatasheet.com  |   English : Alldatasheet.net  |   Chinese : Alldatasheetcn.com  |   German : Alldatasheetde.com  |   Japanese : Alldatasheet.jp
Russian : Alldatasheetru.com  |   Korean : Alldatasheet.co.kr  |   Spanish : Alldatasheet.es  |   French : Alldatasheet.fr  |   Italian : Alldatasheetit.com
Portuguese : Alldatasheetpt.com  |   Polish : Alldatasheet.pl  |   Vietnamese : Alldatasheet.vn
Indian : Alldatasheet.in  |   Mexican : Alldatasheet.com.mx  |   British : Alldatasheet.co.uk  |   New Zealand : Alldatasheet.co.nz
Family Site : ic2ic.com  |   icmetro.com