Basic Serial Communications
Let's start out by writing routines to implement basic serial communications through the standard COM1 port. The basic functions that need to be implemented are the following:
Open the communications port using CreateFile
Create a thread to read from the communications port using ReadFile
Write to the communications port using WriteFile
Close the communications port using CloseHandle
The CreateFile function is used to open a communications port—this is the same function described in Chapter 2 for opening and creating files. In addition, the communications port will need to be configured for speed of transmission, handshaking protocols, and timeout values. A thread is used to read data from the communications port so that ...
Get Windows® CE 3.0 Application Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.