User`s manual

User’s Manual 63
4.5.4 Serial Communication
Library files included with Dynamic C provide a full range of serial communication sup-
port. The RS232.LIB library provides a set of circular-buffer-based serial functions. The
PACKET.LIB library provides packet-based serial functions where packets can be delim-
ited by the 9th bit, by transmission gaps, or with user-defined special characters. Both
libraries provide blocking functions, which do not return until they are finished transmit-
ting or receiving, and nonblocking functions, which must be called repeatedly until they
are finished. For more information, see the Dynamic C Function Reference Manual and
Technical Note 213, Rabbit 2000 Serial Port Software.
If you are planning to use any of the RS-232 serial ports and the RabbitNet port on the
OP7200, initialize the serial port(s) before you initialize the RabbitNet port. The follow-
ing sample code illustrates this sequence.
// Initialize Serial Port C, set baud rate to 19200
serCopen(19200);
serCwrFlush();
serCrdFlush();
// Initialize Serial Port D, set baud rate to 19200
serDopen(19200);
serDwrFlush();
serDrdFlush();
// Set serial mode...must be done after serXopen function(s)
and before Rabbitnet initialization
serMode(0);
// Initialize RabbitNet port
rn_init(RN_PORTS, 1);
Use the following function calls with the OP7200. Note that Serial Port B is used for both
RS-485 and the RabbitNet port, so that RS-485 is no longer available once you have con-
figured Serial Port B as a RabbitNet port.