Timer Operation Example - Samsung S5PC110 Manual

Risc microprocessor
Table of Contents

Advertisement

S5PC110_UM

1.3.4 TIMER OPERATION EXAMPLE

Example of timer operation is shown in
1
TOUTn
Steps in timer operation:
1. Enable the auto-reload feature. Set the TCNTBn as 159(50+109) and TCMPBn as 109. Set the manual
update bit on and set the manual update bit off. Set the inverter on/ off bit. The manual update bit sets
TCNTn and TCMPn to the value of TCNTBn and TCMPBn.
2. Set TCNTBn and TCMPBn as 79(40+39) and 39.
3. Start Timer: Set the start bit in TCON
4. If TCNTn and TCMPn have the same value, the logic level of TOUTn is changed from low to high
5. When TCNTn reaches 0, it generates interrupt request.
6. TCNTn and TCMPn are automatically reloaded with TCNTBn and TCMPBn as (79(40+39)) and 39.
In the Interrupt Service Routine (ISR), the TCNTBn and TCMPBn are set as 79(20+59) and 59.
7. If TCNTn and TCMPn have the same value, the logic level of TOUTn is changed from low to high
8. When TCNTn reaches to 0, it generates interrupt request.
9. TCNTn and TCMPn are automatically reloaded with TCNTBn, TCMPBn as (79(20+59)) and 59.
The, auto-reload and interrupt request are disabled to stop the timer in the ISR.
10. If TCNTn and TCMPn have the same value, the logic level of TOUTn is changed from low to high
11. Even if TCNTn reaches to 0, no interrupt request is generated.
12. TCNTn is not reloaded and the timer is stopped because auto-reload is disabled.
Figure
1-5.
2
3
50
Figure 1-5
4
6
109
40
110
5
Example of a Timer Operation
1 PULSE WIDTH MODULATION TIMER
7
9
10
39
20
59
40
60
8
11
1-8

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents