hit counter script

Operation As Pwm Output (Timer B0 Only) - NEC mPD780344 Series User Manual

8-bit single-chip microcontrollers
Table of Contents

Advertisement

7.4.4 Operation as PWM output (timer B0 only)

In the PWM output mode, a pulse of any duty ratio can be output by setting a low-level width using CRB0 and a
high-level width using CRHB0.
To operate timer B0 in PWM output mode, settings must be made in the following sequence.
<1> Disable operation of 8-bit timer counter B0 (TMB0) (TCEB0 = 0).
<2> Disable timer output of TOB0 (TOEB0 = 0).
<3> Set the count clock for timer B0.
<4> Set the operation mode of timer B0 to PWM output mode (see Figure 7-5).
<5> Set count values in CRB0 and CRHB0.
<6> Set P06 to output mode (PM06 = 0) and the P06 output latch to 0 and enable timer output of TOB0 (TOEB0
= 1).
<7> Enable the operation of TMB0 (TCEB0 = 1).
The operation in the PWM output mode is as follows.
<1> When the count value of TMB0 matches the value set in CRB0, an interrupt request signal (INTTMB0) is
generated and output status of timer B0 is inverted, which makes the compare register switch from CRB0
to CRHB0.
<2> A match between TMB0 and CRB0 clears the TMB0 value to 00H and then counting starts again.
<3> After that, when the count value of TMB0 matches the value set in CRHB0, an interrupt request signal
(INTTMB0) is generated and output status of timer B0 is inverted again, which makes the compare register
switch from CRHB0 to CRB0.
<4> A match between TMB0 and CRHB0 clears the TMB0 value to 00H and then counting starts again.
A pulse of any duty ratio is output by repeating <1> to <4> above. Figures 7-22 and 7-23 show the operation timing
in the PWM output mode.
CHAPTER 7 8-BIT TIMERS A0, B0
User's Manual U15798EJ2V0UD
185

Advertisement

Table of Contents
loading

Table of Contents