Operations; Initialization - Epson S1C17W12 Technical Manual

Cmos 16-bit single chip microcontroller
Table of Contents

Advertisement

15 16-BIT PWM TIMERS (T16B)

15.4 Operations

15.4.1 Initialization

T16B Ch.n should be initialized and started counting with the procedure shown below. Perform initial settings for
comparator mode when using T16B as an interval timer, PWM waveform generator, or external event counter. Per-
form initial settings for capture mode when using T16B to measure external event periods/cycles.
Initial settings for comparator mode
1. Configure the T16B Ch.n operating clock.
2
Set the T16BnCTL.MODEN bit to 1.
3. Set the following T16BnCCCTL0 and T16BnCCCTL1 register bits:
- Set the T16BnCCCTLm.CCMD bit to 0. *
- T16BnCCCTLm.CBUFMD[2:0] bits
* Another circuit in the comparator/capture circuit pair (circuits 0 and 1, 2 and 3, 4 and 5) can be set to
capture mode.
Set the following bits when the TOUTnm output is used.
- T16BnCCCTLm.TOUTMT bit
- T16BnCCCTLm.TOUTMD[2:0] bits
- T16BnCCCTLm.TOUTINV bit
4. Set the T16BnMC register.
5. Set the T16BnCCR0 and T16BnCCR1 registers.
6. Set the following bits when using the interrupt:
- Write 1 to the interrupt flags in the T16BnINTF register.
- Set the interrupt enable bits in the T16BnINTE register to 1. (Enable interrupts)
7. Set the following T16BnCTL register bits:
- T16BnCTL.CNTMD[1:0] bits
- T16BnCTL.ONEST bit
- Set the T16BnCTL.PRESET bit to 1.
- Set the T16BnCTL.RUN bit to 1.
Initial settings for capture mode
1. Configure the T16B Ch.n operating clock.
2
Set the T16BnCTL.MODEN bit to 1.
3. Set the following T16BnCCCTL0 and T16BnCCCTL1 register bits:
- Set the T16BnCCCTLm.CCMD bit to 1. *
- T16BnCCCTLm.SCS bit
- T16BnCCCTLm.CAPIS[1:0] bits
- T16BnCCCTLm.CAPTRG[1:0] bits
* Another circuit in the comparator/capture circuit pair (circuits 0 and 1, 2 and 3, 4 and 5) can be set to
comparator mode.
4. Set the T16BnMC register.
5. Set the following bits when using the interrupt:
- Write 1 to the interrupt flags in the T16BnINTF register.
- Set the interrupt enable bits in the T16BnINTE register to 1. (Enable interrupts)
6. Set the following T16BnCTL register bits:
- T16BnCTL.CNTMD[1:0] bits
- T16BnCTL.ONEST bit
- Set the T16BnCTL.PRESET bit to 1.
- Set the T16BnCTL.RUN bit to 1.
15-4
Seiko Epson Corporation
(Enable T16B operations)
(Set comparator mode)
(Configure compare buffer)
(Select waveform generation signal)
(Select TOUT signal generation mode)
(Select TOUT signal polarity)
(Set MAX counter data)
(Set the counter comparison value)
(Clear interrupt flags)
(Select count up/down operation)
(Select one-shot/repeat operation)
(Reset counter)
(Start counting)
(Enable T16B operations)
(Set capture mode)
(Set synchronous/asynchronous mode)
(Set trigger signal)
(Select trigger edge)
(Set MAX counter data)
(Clear interrupt flags)
(Select count up/down operation)
(Select one-shot/repeat operation)
(Reset counter)
(Start counting)
S1C17W12/W13 TECHNICAL MANUAL
(Rev. 1.2)

Advertisement

Table of Contents
loading

This manual is also suitable for:

S1c17w13

Table of Contents