Siemens ERTEC200 Manuel D’Utilisation

Page de 97
 
4.3.1.1 
Timer 0/1 Interrupts 
The timer 0/1 interrupt is active (High) starting from the point at which the timer value is counted down to 0.  
The timer interrupt is deactivated (Low) when the reload value is automatically reloaded or the "LOAD“ bit is set by the 
user. The interrupt is not reset when the  reload value 0 is loaded. If the timer is deactivated (Run/XStop = 0), the 
interrupt is also deactivated.  
If the timer operates in reload mode without a prescaler, the interrupt is present only for one 50 MHz cycle. This must be 
taken into account when assigning the relevant interrupt input (level/edge evaluation).   
4.3.1.2 
Timer 0/1 Prescaler 
• 
An 8-bit prescaler is available for timer 0/1. 
• 
Both prescalers are deactivated after RESET and deactivated by setting the Run/xStop_V bit in the control 
register. 
• 
Settings can be made independently for each prescaler. 
• 
Both prescalers have their own 8-bit reload register.  
• 
If the reload value or starting value of the prescaler is 0, prescaling does not occur.  
• 
The current prescaler value cannot be read out.  
• 
There are no status bits for the prescalers indicating the value 0.  
• 
The prescalers always run in Reload mode. 
 
4.3.1.3 
Cascading of Timers 0/1 
If the "Cascading" bit is set, both timers can be cascaded to form one 64-bit timer.  
The cascaded timer is enabled via the status/control register of Timer 1. The interrupt of Timer 1 is active. The interrupt 
of Timer 0 must be disabled when the timers are cascaded. When prescalers are specified, the prescaler of Timer 1 is 
used.  
 
The user must provide for data consistency in the user software when reading out the 64-bit timer. 
 
4.3.2 Timer 
 
Timer2 has the following functionality: 
 
ƒ 
16-bit count register 
ƒ 
Fixed 50 MHz input clock 
ƒ Up-counter 
ƒ 
16-bit reload value 
ƒ Start/stop 
function 
ƒ 
Interrupt when counter state 0 is reached 
ƒ 
Different function modes can be assigned (one-shot, cycle, and retrigger mode) 
 
Timer 2 can be used for general monitoring functions.  
 
Timer2-Modi: 
• 
One-Shot-Mode:  
TIM2_CTRL_REGISTER( OneShot_Mode = 1, Timer_Mode = 0) 
When Timer2 is started with Run/xStop_T2=1, it counts up from zero until it reaches the reload value. When the 
reload value is reaches, Timer 2 is stopped, and the Timer2 interrupt is generated. Timer2 remains at the reload 
value. If RUN/xSTOP = 0 is set, then Timer2 is reset to zero, and the Timer2 interrupt is deactivated again. 
• 
Cycle mode: 
 
TIM2_CTRL_REGISTER( OneShot_Mode = 0, Timer_Mode = 0) 
If the timer is started with Run/xStop_T2=1, it counts up from zero until it reaches the reload value. When the 
reload value is reached, the Timer2 interrupt is activated, Timer 2 is reset to zero, and the count process 
resumes. If RUN/xSTOP = 0 is set, then Timer2 is stopped, the Timer2 value is reset to zero, and if the Timer2 
interrupt was activated, it is deactivated again. 
• 
Retrigger mode:  
TIM2_CTRL_REGISTER( OneShot_Mode = 0, Timer_Mode = 1) 
The timer is operated in one-shot mode with retriggering of UART RxD.  
If the timer is started with Run/xStop_T2=1, then the timer only counts when the UART-RxD cable is at level 1. 
 When the level is 1, the timer value is reset to zero.  Further operation of the timer and the interrupt generation 
are the same as in one-shot mode. 
 
 
Copyright © Siemens AG 2007. All rights reserved.                  
39
             
ERTEC 200 Manual 
Technical data subject to change                                                                                                                                Version 1.1.0