views:

28

answers:

1

Hello Evryone.

I am new to this type of programming..i just want some help...regarding what to do when u need to extract the data from the serial port..and how to check that tha data is available in the serial port..so that no data loss is there....

A: 

You dont access the serial port directly. The O/S provides a device driver with a set of API function for use of the serial port.

You open the driver with the CreateFile function and get a handle to the driver. Using this handle you call the functions of the as found in the Communications Reference.

When your serial port ist configured properly you can read the data using ReadFile. Using overlapped I/O you can get a handle to a wait event, that's signaled when data is available. As an opposite you can wait for an event as "data available" with the WaitCommEvent function.

Since the data is received with an ISR into an driver internal buffer, you can read the data without losing characters.

harper