![Honeywell RS-232 Скачать руководство пользователя страница 28](http://html.mh-extra.com/html/honeywell/rs-232/rs-232_reference-manual_149050028.webp)
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
Содержание RS-232
Страница 12: ...Overview 2 RS232 Communications Reference Manual 8 99 ...
Страница 24: ...Protocol Description 14 RS232 Communications Reference Manual 8 99 ...
Страница 36: ...PC Communication Driver 26 RS232 Communications Reference Manual 8 99 ...
Страница 121: ...Function Parameter Index Reference 8 99 RS232 Communications Reference Manual 111 Static Configuration Parameters None ...
Страница 143: ...Function Parameter Index Reference 8 99 RS232 Communications Reference Manual 133 ...
Страница 150: ...Index 140 RS232 Communications Reference Manual 8 99 ...
Страница 151: ......
Страница 152: ...Industrial Automation and Control Honeywell Inc 1100 Virginia Drive Fort Washington Pennsylvania 19034 ...