04.03.2013 Views

RL78/D1A User's Manual: Hardware - Renesas

RL78/D1A User's Manual: Hardware - Renesas

RL78/D1A User's Manual: Hardware - Renesas

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Under development<br />

Preliminary document<br />

Specifications in this document are tentative and subject to change.<br />

<strong>RL78</strong>/<strong>D1A</strong> CHAPTER 6 TIMER ARRAY UNIT<br />

6.7.5 Operation as input signal high-/low-level width measurement<br />

By starting counting at one edge of TImn and capturing the number of counts at another edge, the signal width (highlevel<br />

width/low-level width) of TImn can be measured. The signal width of TImn can be calculated by the following<br />

expression.<br />

Signal width of TImn input = Period of count clock ((10000H TSRn: OVF) + (Capture value of TDRmn + 1))<br />

Caution The TImn pin input is sampled using the operation clock selected with the CKSmn bit of the<br />

TMRmn register, so an error at a maximum of one clock is generated.<br />

TCRmn operates as an up counter in the capture & one-count mode.<br />

When the channel start trigger (TSmn) is set to 1, TEmn is set to 1 and the TImn pin start edge detection wait status is<br />

set.<br />

When the TImn start valid edge (rising edge of TImn when the high-level width is to be measured) is detected, the<br />

counter counts up in synchronization with the count clock. When the valid capture edge (falling edge of TImn when the<br />

high-level width is to be measured) is detected later, the count value is transferred to TDRmn and, at the same time,<br />

INTTMmn is output. If the counter overflows at this time, the OVF bit of the TSRmn register is set to 1. If the counter does<br />

not overflow, the OVF bit is cleared. TCRmn stops at the value “value transferred to TDRmn + 1”, and the TImn pin start<br />

edge detection wait status is set. After that, the above operation is repeated.<br />

As soon as the count value has been captured to the TDRmn register, the OVF bit of the TSRmn register is updated<br />

depending on whether the counter overflows during the measurement period. Therefore, the overflow status of the<br />

captured value can be checked.<br />

If the counter reaches a full count for two or more periods, it is judged to be an overflow occurrence, and the OVF bit of<br />

the TSRmn register is set to 1. However, the OVF bit is configured as an integral flag, and the correct interval value<br />

cannot be measured if an overflow occurs more than once.<br />

Whether the high-level width or low-level width of the TImn pin is to be measured can be selected by using the CISmn1<br />

and CISmn0 bits of the TMRmn register.<br />

Because this function is used to measure the signal width of the TImn pin input, TSmn cannot be set to 1 while TEmn is<br />

1.<br />

CISmn1, CISmn0 of TMRmn = 10B: Low-level width is measured.<br />

CISmn1, CISmn0 of TMRmn = 11B: High-level width is measured.<br />

Remark m: Unit number (m = 0 to 2)<br />

n: Channel number (n = 0 to 7)<br />

R01UH0317EJ0004 Rev. 0.04 424<br />

Feb. 22, 2013

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!