EasyManua.ls Logo

Honeywell UMC800 - I;O module limits

Honeywell UMC800
152 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
PC Communication Driver
18 RS232 Communications Reference Manual 8/99
Code sample 1: instantiation of a driver object on the stack,
continued
{
// Error handling goes here.
}
lRet = CommDriver.ClosePort();
if(lRet)
{
// Error handling goes here.
}
}
3.2.3 Code sample 2: dynamic instantiation of one of two driver objects on the heap
#include “Commbase.h”
#include “Elnapi.h”
void SomeClass::SomeFunction()
{
unsigned char pbyTxMsg[64];
unsigned char pbyRxMsg[64];
int nTxLength;
int nRxLength;
long lRet;
CCommBase* pDriver;
// Dynamically instantiate an EL+N driver object.
pDriver = new CElnApi( “COM2”, // Connect driver to com2.
5000, // 5 sec. timeout.
5, // 5 retries.
if(!pDriver)
{
// Error handling goes here.
}
/*
From this point on we don’t care what kind of driver it is because
all driver objects that are derived from the CCommBase base class
have the same public API functions.
*/
lRet = pDriver->SetUpPort( 9600, // 9600 baud.
FALSE, // No parity.
8, // 8 data bits.
1); // 1 stop bit.
if(lRet)
continued next page

Table of Contents

Other manuals for Honeywell UMC800

Related product manuals