![Honeywell RS-232 Скачать руководство пользователя страница 30](http://html.mh-extra.com/html/honeywell/rs-232/rs-232_reference-manual_149050030.webp)
PC Communication Driver
20
RS232 Communications Reference Manual
8/99
{
// Application error.
if(lRet & ERR_CODE)
// Instrument rejected message and returned error code.
ErrorCode = (int)(lRet & ERR_CODE);
else
// Bad address or sequence number in return packet.
}
}
3.2.5 Multiple Instances of the Driver in the Same App
This driver is completely re-entrant. Suppose there are two separate communication interfaces on COM1
and COM2 respectively for two UMC800 controllers. The app can handle this by creating two instances of
the driver class and attaching them to separate ports:
#include “commapi.h”
CElnApi Drv1(“COM1”,
// COM1.
2000,
// 2000 mS timeout.
5,
// 5 retries.
1000);
// 1000 mS Delay between retries.
CElnApi Drv2(“COM2”,
// COM2.
2000,
// 2000 mS timeout.
5,
// 5 retries.
1000);
// 1000 mS Delay between retries.
3.2.6 Port Lockout
The communication driver relies on the operating system to perform port lockouts in the event that
two concurrently running applications attempt to access the same port simultaneously. For example,
a configuration utility and a live data viewing utility may each instantiate a CElnApi object, and both
CElnApi’s may be attached to the same port. However, they may not both open the port simultaneously,
because the operating system will not issue a valid port handle to app (a)’s driver before app (b)’s driver has
closed the port and returned its handle to the system. This means that if app (a) is still talking when app (b)
tries to start talking, app (b) will get a physical error from CElnApi::OpenPort(). App (b) can then go into a
polling loop waiting for the port to become available, or it can issue an error message to the user.
Always check the return value of this CElnApi::OpenPort(). If someone else has already opened the port,
you cannot get access to it until they close the port. When you are done communicating, close the port. All
other threads, including other apps, will be locked out as long as you have the port open.
Содержание 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 ...