Square-Wave Output Operation; Control Register Settings In Square-Wave Output Mode - NEC 78K0 User Manual

8-bit single-chip microcontrollers
Hide thumbs Also See for 78K0:
Table of Contents

Advertisement

7.4.5

Square-wave output operation

Setting
The basic operation setting procedure is as follows.
<1> Set the count clock by using the PRM0n register.
<2> Set the CRC0n register (see Figure 7-34 for the set value).
<3> Set the TOC0n register (see Figure 7-34 for the set value).
<4> Set any value to the CR00n register (0000H cannot be set).
<5> Set the TMC0n register to start the operation (see Figure 7-34 for the set value).
Caution CR00n cannot be rewritten during TM0n operation.
Remarks 1. For the setting of the TO0n pin, see 7.3 (5) Port mode register 0 (PM0).
2. For how to enable the INTTM00n interrupt, see CHAPTER 19 INTERRUPT FUNCTIONS.
A square wave with any selected frequency can be output at intervals determined by the count value preset to 16-
bit timer capture/compare register 00n (CR00n).
The TO0n pin output status is reversed at intervals determined by the count value preset to CR00n + 1 by setting
bit 0 (TOE0n) and bit 1 (TOC0n1) of 16-bit timer output control register 0n (TOC0n) to 1. This enables a square wave
with any selected frequency to be output.
Figure 7-34. Control Register Settings in Square-Wave Output Mode (1/2)
7
6
5
TMC0n
0
0
0
7
6
5
CRC0n
0
0
0
202
CHAPTER 7 16-BIT TIMER/EVENT COUNTERS 00 AND 01
(a) 16-bit timer mode control register 0n (TMC0n)
4
TMC0n3
TMC0n2
TMC0n1
OVF0n
0
1
1
0
(b) Capture/compare control register 0n (CRC0n)
4
3
CRC0n2
CRC0n1
CRC0n0
0
0
0/1
0/1
User's Manual U15947EJ2V0UD
*
0
Clears and starts on match between TM0n and CR00n.
0
CR00n used as compare register

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

78kf1

Table of Contents