<< Previous | Next >>

serXparity

void serXparity( int parity_mode ); /* where X is A-F */

Description

Sets parity mode for channel X. A call to serXopen() must be made before calling this function.

Parity generation for 8-bit data can be unusually slow due to the current method for generating high 9th bits. Whenever a 9th high bit is needed, the UART is disabled for approximately 10 baud times to create a long stop bit that should be recognized by the receiver as a high 9th bit.

The long delay is imposed because we are using the serial port itself to handle timing for the delay. Creating a shorter delay would the require use of some other timer resource.

This function is non-reentrant.

The functions serEparity() and serFparity() may be used with the Rabbit 3000 and Rabbit 4000.

NOTE Alternatively you can use another form of this function that has been generalized for all serial ports. Instead of substituting for "X" in the function name, the prototype of the generalized function is: serXparity(int port, ...), where "port" is one of the macros SER_PORT_A through SER_PORT_F.

Parameters

parity_mode
An integer indicating what parity mode to use. It is best to use one of the macros provided:

  • PARAM_NOPARITY - Disables parity handling (default).

  • PARAM_OPARITY - Odd parity; parity bit set to "0" if odd number of 1's in data bits.

  • PARAM_EPARITY - Even parity; parity bit set to "1" if even number of 1's in data bits.

  • PARAM_MPARITY - Mark parity; parity bit always set to logical 1. (Rabbit 4000 only)

  • PARAM_SPARITY - Space parity; parity bit always set to logical 0. (Rabbit 4000 only)

  • PARAM_2STOP - 2 stop bits.

From a logical standpoint, the first three of these PARAM_ macros cannot be combined, but even PARAM_2STOP must stand alone due to limitations in the UART hardware that will not allow parity bits and extra stop bits.

Library

RS232.LIB


Dynamic C Functions << Previous | Next >> rabbit.com