<< Previous | Next >>

TAT1R_SetValue

char TAT1R_SetValue( int requestor, int value );

Description

If not already in use, or if in a compatible use, allocates the TAT1R resource (sets a new or keeps the current TAT1R value) as requested. Also enables or disables the requestor's timer A1 cascade bit(s) in TACR or TBCR, as appropriate. When the timer B cascade from timer A1 is disabled in TBCR the timer B "clocked by PCLK/2" is then enabled.

A run time error occurs if parameter(s) are invalid and also, this function is not reentrant.

NOTE This function does not attempt to manage interrupts that are associated with timers A or B; that work is left entirely up to the application.

Parameters

requestor
The requestor of the TAT1R resource. Use exactly one of the following macros to specify the appropriate requestor:

  • TAT1R_A1TIMER_REQ (e.g., direct use of Timer A1)

  • TAT1R_A2TIMER_REQ (e.g., use by serial port E)

  • TAT1R_A3TIMER_REQ (e.g., use by serial port F)

  • TAT1R_A4TIMER_REQ (e.g., use by serial port A)

  • TAT1R_A5TIMER_REQ (e.g., use by serial port B)

  • TAT1R_A6TIMER_REQ (e.g., use by serial port C)

  • TAT1R_A7TIMER_REQ (e.g., use by serial port D)

  • TAT1R_BTIMER_REQ (e.g., use with PWM, servo or triac)

value
Either the new TAT1R setting value (0 to 255, inclusive), or the macro TAT1R_RELEASE_REQ to release the TAT1R resource in use by the specified requestor.

Return Value

The new or current TAT1R setting. The caller should check their requested new TAT1R value against this return value. If the two values are not the same, the caller may decide the return value is acceptable after all and make another request using the previous return value. A valid release request always succeeds; in this case there is no need for the caller to check the return value.

Library

sys.lib


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