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

X  

AN197 Fiches technique(PDF) 6 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) 6 Page - Silicon Laboratories

Back Button AN197 Datasheet HTML 2Page - Silicon Laboratories AN197 Datasheet HTML 3Page - Silicon Laboratories AN197 Datasheet HTML 4Page - Silicon Laboratories 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 Next Button
Zoom Inzoom in Zoom Outzoom out
 6 / 14 page
background image
AN197
6
Rev. 0.6
5. Closing the COM Port
After all communication is finished, then the COM port should then be closed. First, the COM port should be set
back to its initial state, and then the handle to the COM port should be closed and set to an invalid handle. Example
code is shown below:
SetCommState(hMasterCOM, &dcbMasterInitState);
Delay(60);
CloseHandle(hMasterCOM);
hMasterCOM = INVALID_HANDLE_VALUE;
The SetCommState() function works the same as described in "3.3. Setting up a DCB Structure to Set the New
COM State" on page 2. A delay of 60 ms is used to make sure the settings have time to be set. Finally the device is
closed using the CloseHandle() function. This function just takes in the handle of the COM port. After this function
is called, it is important to set the variable to an INVALID_HANDLE_VALUE.
6. Sample program to Demonstrate Serial Communications
Included in the AN197SW.zip is a directory named "CP210xSerialTest" which contains the source code and
executables for a Visual Studio project that makes use of all the serial communication functions described in
section 3., section 4., and section 5. The program is a basic dialog based application that accepts two COM port
numbers, and then will send a test array of 64 bytes of data back and forth between them.
7. Discovering CP210x COM Port
To use the described functionality with a COM port, the number of the COM port needs to be known. In order to find
out the COM port number of a CP210x device, the VID, PID, and serial number are used to lookup a registry key.
This key is different between Windows XP/2000/Server 2003/Vista and Windows 98. Here are the keys that will
need to be looked up:
WinXP/2000/Server 2003/Vista (Driver Version 5.0 and higher):
HKLM\System\CurrentControlSet\Enum\USB\Vid_xxxx&Pid_yyyy\zzzz\DeviceParameters\PortName
WinXP/2000/Server 2003/Vista (Driver Version 4.40 and lower):
HKLM\System\CurrentControlSet\Enum\USB\Vid_xxxx&Pid_yyyy&Mi_00\zzzz_00\DeviceParameters\PortName
(where xxxx is the VID, yyyy is the PID, and zzzz is the serial number)



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