O'Reilly logo

Windows® CE 3.0 Application Programming by Marshall Brain, Nick Grattan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required