<< Previous | Next >> | |
|
long SetSerialTATxRValues( long bps, char *divisor, int tatXr );
Description
- Sets up the possibly shared serial timer (TATxR) resources required to achieve, as closely as possible, the requested serial bps rate. The algorithm attempts to find, when necessary and if possible, the lowest value for the TAT1R that will precisely produce the requested serial bps rate. For this reason, an application that requires the TAT1R to be shared should generally first set up its usage with (1) the most critical timer A1 cascade rate, or (2) the lowest timer A1 cascade rate. That is, consider setting up the most critical stage (PWM, servo, triac, ultra-precise serial rate, etc.) first, else set up the slowest usage (often, the lowest serial rate) first.
- Note that this function provides no TATxR resource sharing protection for an application that uses any of the individual TATxR resources either directly or indirectly. For example, this function affords no protection to an application that sets a direct usage TAT7R timer interrupt and also opens serial port D such that TAT7R is used to set the serial data rate.
- A run time error occurs if parameter(s) are invalid. Also, this function is not reentrant.
Parameters
- bps
- The requested serial bits per second (BPS, baud) rate.
- divisor
- An optional pointer to the caller's serial timer divisor variable. If the caller is not interested in the actual serial timer (TATxR) divisor value that is set by this function, then NULL may be passed.
- tatXr
Return Value
- The actual serial rate BPS (baud) setting that was achieved.
Library
- sys.lib
See Also
- TAT1R_SetValue
Dynamic C Functions | << Previous | Next >> | rabbit.com |