Download Print this page

Epson S1C31D50 Technical Instructions page 269

Cmos 32-bit single chip microcontroller
Hide thumbs Also See for S1C31D50:

Advertisement

17.4. Operations
17.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.
-
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.
-
6. 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.
7. 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.
-
17-4
(Set MAX counter data)
(Set synchronous/asynchronous mode)
(Set MAX counter data)
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 the counter comparison value)
(Clear interrupt flags)
(Enable interrupts)
(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 trigger signal)
(Select trigger edge)
(Clear interrupt flags)
(Enable interrupts)
(
Enable DMA transfer requests)
(Select count up/down operation)
(Select one-shot/repeat operation)
(Reset counter)
(Start counting)
S1C31D50 TECHNICAL MANUAL
(Rev. 1.00)

Advertisement

loading