Action
This configuration statement configures timer TCB0/TCB1 found in the XTINY.
Syntax
CONFIG TCB0|TCB1=mode, RUN=run, RUNMODE=runmode , SYNCUPDATE=syncupdate, ASYNC=async, CCMP_INIT=ccmp_init, CCMP_OTP=ccmp_otp, FILTER=filter, EDGE=edge, CAPT_EVENT=ecapt_event, CAPT_INT=capt_int
Remarks
At the moment of writing, all XTINY processors have one TIMER TCB0. Some processors have 2 TCB timers like the tiny3216.
The second TCB timer is named TCB1.
The TCB is is a 16 bit timer with the following capabilities :
• 16-Bit Counter Operation Modes:
– Periodic interrupt
– Time-out check
– Input capture
• On event
• Frequency measurement
• Pulse-width measurement
• Frequency and pulse-width measurement
– Single shot
– 8-bit Pulse-Width Modulation (PWM)
• Noise Canceler on Event Input
• Optional: Operation Synchronous with TCA0
You best read that before you use the timer.
After reading the data sheet the following options will make more sense.
mode |
This options sets the Timer mode. Possible values :
- PERIODIC_INT : Periodic interrupt - TIME_OUT_CHECK : time out check - INP_CAP_EVENT : input capture event - INP_CAP_FREQ : input capture frequency - INP_CAP_PWM : input capture pulse with measurement - INP_CAP_FREQ_PWM : input capture frequency width measurement - SINGLE_SHOT : single shot - PWM : 8 bit PWM
- A value between 0-7 will load the mode. See table 2. |
||||||||||||||||||||||||||||||||||||||||
PRESCALE or CLOCKSEL |
The pre scaler can divide the system clock that is applied to the timer. The pre scaler will only divide the system clock. Possible values : - 1 , 2 - TCA0 : uses CLK_TCA from timer TCA0 - OFF, timer is disabled |
||||||||||||||||||||||||||||||||||||||||
RUN |
This enables or disables the timer. Possible values : ON : timer will run OFF : timer will stop |
||||||||||||||||||||||||||||||||||||||||
RUNMODE |
Run in standby mode. ENABLED : the timer runs in standby sleep mode. Except when PRESCALE is set to TCA0. DISABLED : timer is stopped in standby sleep mode. |
||||||||||||||||||||||||||||||||||||||||
SYNCUPDATE
|
Synchronize Update. ENABLED : TCB will restart whenever the TCA0 counter is restarted or overflows. This can be used to synchronize capture with the PWM period DISABLED : no sync |
||||||||||||||||||||||||||||||||||||||||
ASYNC |
Asynchronous Enabling. ENABLED : asynchronous updates of the TCB signal in single shot mode The output will go HIGH when an event arrives DISABLED : The output will go HIGH when the counter starts after synchronization. |
||||||||||||||||||||||||||||||||||||||||
CCMP_INIT |
Compare/Capture PIN initial value. This setting is used to set the initial output value of the pin when an pin output is used. This bit has no effect in 8 bit PWM and single shot mode. LOW : initial pin state is low HIGH : initial pin state is high |
||||||||||||||||||||||||||||||||||||||||
CCMP_OTP |
Compare/Capture output enable. This option is used to set the output value of the compare/capture output DISABLED : Compare/capture output is zero. ENABLED : Compare/capture output has a valid value |
||||||||||||||||||||||||||||||||||||||||
FILTER |
Filter capture noise cancellation filter. ENABLED : the input capture noise cancellation unit is enabled DISABLED : input capture noise cancellation unit is disabled. |
||||||||||||||||||||||||||||||||||||||||
EDGE |
Event Edge. This selects the event edge. The effect of this depends on the selected count mode.
|
||||||||||||||||||||||||||||||||||||||||
CAPT_EVENT |
Capture Event input enable. ENABLED : event input capture is enabled. DISABLED : event input capture is disabled |
||||||||||||||||||||||||||||||||||||||||
CAPT_INT |
All interrupts can be enabled/disabled using the ENABLE/DISABLE statements. The Capture interrupt enable can be enabled/disabled using the configuration parameter. ENABLED : capture interrupt is enabled DISABLED : capture interrupt is disabled |
See also
Example