User Manual
Table Of Contents
- About This Guide
- Introduction
- Kit Installation
- iB-5209 Network Monitor Operations
- iB-5209 Network Monitor Overview
- Setting Thread Priority
- Configuring a Node’s Operation
- Using Watch function to display current I/O information
- Configuring Sample Interval of Single Node
- Configuring Sample Interval of all Network Nodes
- Configuring Digital I/O Operation
- Configuring UART Operation
- Configuring AD (analog-to-digital) Converter Operation
- Configuring RS-232 Operation (RT-5209 only)
- Configuring RS-485 Operation (RT-5209 only)
- Labeling i-Bean Endpoint or i-Bean Router
- Creating an Event Log File
- Configure Persistence Attributes
- Configure Serial and ADC Data Formats
- Select Com Port on Host PC
- View Monitor Statistics
- View Contents of Event Log File
- Enable Multiple Capture
- API Functions
- Sample Application
EK-5209-5 Evaluation Kit User’s Guide A-29
Example API Code
/***************************************************************************/
void WaitForKey(void) {
printf("\r\nPress any key to close...");
_getch();
printf("\r\n");
}
/****************************************************************************
* This is a simple wrapper for detecting and reporting API error return
* values. In C++, this function could throw an exception object.
*/
ibApi_RESULT CheckResult(ibApi_RESULT result) {
char error_text[256];
/*
* Error codes always have a negative value.
*/
if (result >= 0) return result;
/*
* For the purposes of this example, ibApi_RESULT_ERR_TIMEOUT is not a
* fatal error.
*/
if (result == ibApi_RESULT_ERR_TIMEOUT) return result;
/*
* This interprets the error code, writing the result to the error_text
* variable
*/
ibApi_Utils_GetErrorDescription(result,error_text,sizeof(error_text));
printf("\r\nERROR: %s\r\n",error_text);
/*
* Technically, ibApi_Close() should be called before exiting, e.g. via
* an atexit() handler. (This is omitted in the example for simplicity.)
*/
WaitForKey();
exit(1);
return 0;
}