Advantech PCI-1682U Manual de usuario Pagina 53

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 104
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 52
47 PCI-1680U/1682U User Manual
Chapter 4 Software Requirements
if (hDevice == INVALID_HANDLE_VALUE)
{
// Handle the error.
printf("CreateFile failed with error %d.\n", GetLas-
tError());
return;
}
// Set the event mask.
bSuccess = SetCommMask(hDevice, EV_ERR | EV_RXCHAR);
if (!bSuccess)
{
// Handle the error.
printf("SetCommMask failed with error %d.\n", GetLas-
tError());
return;
}
// Create an event object for use by WaitCommEvent.
ov.hEvent = CreateEvent(
NULL, // default security attributes
FALSE, // auto reset event
FALSE, // not signaled
NULL // no name
);
// Intialize the rest of the OVERLAPPED structure to
zero.
ov.Internal = 0;
ov.InternalHigh = 0;
ov.Offset = 0;
ov.OffsetHigh = 0;
if (WaitCommEvent(hDevice, &dwEvtMask, &ov))
{
if (dwEvtMask & EV_ERR)
{
// To do.
}
if (dwEvtMask & EV_RXCHAR)
{
// To do.
Vista de pagina 52
1 2 ... 48 49 50 51 52 53 54 55 56 57 58 ... 103 104

Comentarios a estos manuales

Sin comentarios