Code Sample 3: Error Handling - Honeywell UMC800 Reference Manual

Rs232 communications
Hide thumbs Also See for UMC800:
Table of Contents

Advertisement

Code sample 2: dynamic instantiation of one of two driver objects on the heap, continued
{
// Error handling goes here.
}
sprintf(pbyTxMsg, "My dog has fleas.")
lRet = pDriver->OpenPort();
if(lRet)
{
/*
Error handling goes here.
out access to the port.
*/
}
lRet = pDriver->TransCeive(
if(lRet)
{
// Error handling goes here.
}
lRet = pDriver->ClosePort();
if(lRet)
{
// Error handling goes here.
}
if(pDriver)
delete pDriver;
}

3.2.4 Code sample 3: error handling

if(lRet)
{
if(lRet & ERR_RX_OVERRUN)
// Receive overrun error.
else if(lRet & ERR_LINK)
// Link error: bad CRC indicates garbled data.
else if(lRet & ERR_PHYSICAL)
// Physical error: timeout, baud rate, parity or framing.
else if(lRet & ERR_APPLICATION)
8/99
Chances are another application has locked
pbyTxMsg,
pbyRxMsg,
17,
64,
&nRxLength,
1);
// Destroy the comm driver object.
RS232 Communications Reference Manual
// Outgoing message ptr.
// Rx buffer.
// Outgoing msg length.
// Rx buffer size.
// Actual length of Rx.
// Unit addr. 1.
PC Communication Driver
19

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Rs232

Table of Contents