21.07.2015 Views

M16C User Manual.pdf

M16C User Manual.pdf

M16C User Manual.pdf

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Timer BMitsubishi microcomputers<strong>M16C</strong> / 62 GroupSINGLE-CHIP 16-BIT CMOS MICROCOMPUTER2.3 Timer B2.3.1 OverviewThe following is an overview for timer B, a 16-bit timer.(1) ModeTimer B operates in one of three modes:(a) Timer modeThe internal count source is counted.• Operation in timer mode ........................................................................................................... P316(b) Event counter modeThe number of pulses coming from outside and the number of the timer overflows are counted.• Operation in event counter mode ............................................................................................. P318(c) Pulse period measurement/pulse width measurement modeExternal pulse period or external pulse widths are measured. If pulse period measurement mode isselected, the periods of input pulses are continuously measured. If pulse width measurement modeis selected, widths of “H” level pulses and those of “L” level pulses are continuously measured.• Operation in pulse period measurement mode ........................................................................ P320• Operation in pulse width measurement mode .......................................................................... P322(2) Count sourceAn internal count source can be selected from f1, f8, f32, and fC32. f1, f8, and f32 are clocks obtained bydividing the CPU main clock by 1, 8, and 32 respectively. fC32 is the clock obtained by dividing theCPU secondary clock by 32.(3) Frequency division ratioThe frequency division ratio equals [the value set in the timer register + 1]. The counter underflowswhen a count source equal to a frequency division ratio is input, and an interrupt request occurs.(4) Reading the timerIn timer mode or event counter mode, the count value at the time of reading the timer register will beread. Read the register in 16-bit increments. In both the pulse period measurement mode and pulsewidth measurement mode, an indeterminate value is read until the second effective edge is input aftera count is started, otherwise, the measurement results are read.(5) Writing to the timerWhen writing to the timer register while a count is in progress, the value is written only to the reloadregister. When writing to the timer register while a count has stopped, the value is written both to thereload register and the count. Write the value in 16-bit increments. The timer register cannot bewritten to in either the pulse period measurement mode or the pulse width measurement mode.312

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

Saved successfully!

Ooh no, something went wrong!