Operations; Initialization - Epson S1C31W65 Technical Manual

Cmos 32-bit single chip microcontroller
Table of Contents

Advertisement

16 16-BIT PWM TIMERS (T16B)

16.4 Operations

16.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 T16B_nCTL.MODEN bit to 1.
3. Set the following T16B_nCCCTL0 and T16B_nCCCTL1 register bits:
- Set the T16B_nCCCTLm.CCMD bit to 0. *
- T16B_nCCCTLm.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.
- T16B_nCCCTLm.TOUTMT bit
- T16B_nCCCTLm.TOUTMD[2:0] bits
- T16B_nCCCTLm.TOUTINV bit
4. Set the T16B_nMC register.
5. Set the T16B_nCCR0 and T16B_nCCR1 registers.
6. Set the following bits when using the interrupt:
- Write 1 to the interrupt flags in the T16B_nINTF register.
- Set the interrupt enable bits in the T16B_nINTE register to 1. (Enable interrupts)
7. Configure the DMA controller and set the following T16B control bits when using DMA transfer:
- Write 1 to the DMA transfer request enable bits in the
T16B_nMZDMAEN and T16B_nCCmDMAEN registers.
8. Set the following T16B_nCTL register bits:
- T16B_nCTL.CNTMD[1:0] bits
- T16B_nCTL.ONEST bit
- Set the T16B_nCTL.PRESET bit to 1.
- Set the T16B_nCTL.RUN bit to 1.
Initial settings for capture mode
1. Configure the T16B Ch.n operating clock.
2
Set the T16B_nCTL.MODEN bit to 1.
3. Set the following T16B_nCCCTL0 and T16B_nCCCTL1 register bits:
- Set the T16B_nCCCTLm.CCMD bit to 1. *
- T16B_nCCCTLm.SCS bit
- T16B_nCCCTLm.CAPIS[1:0] bits
- T16B_nCCCTLm.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 T16B_nMC register.
5. Set the following bits when using the interrupt:
- Write 1 to the interrupt flags in the T16B_nINTF register.
- Set the interrupt enable bits in the T16B_nINTE register to 1. (Enable interrupts)
16-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)
(Enable DMA transfer requests)
(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)
S1C31W65 TECHNICAL MANUAL
(Rev. 1.1)

Advertisement

Table of Contents
loading

Table of Contents