11.07.2015 Views

uPD789074 Subseries 8-Bit Single-Chip Microcontrollers UD - Home

uPD789074 Subseries 8-Bit Single-Chip Microcontrollers UD - Home

uPD789074 Subseries 8-Bit Single-Chip Microcontrollers UD - Home

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

CHAPTER 7 8-BIT TIMER/EVENT COUNTER 807.4.2 Operation as external event counterThe external event counter counts the number of external clock pulses input to the TI80/P27/TO80 pin by using 8-bit timer counter 80 (TM80).To operate 8-bit timer/event counter 80 as an external event counter, settings must be made in the followingsequence. Set P27 to input mode (PM27 = 1). Disable operation of 8-bit timer counter 80 (TM80) (TCE80 (bit 7 of 8-bit timer mode control register 80(TMC80)) = 0). Specify the rising or falling edge of TI80 (see Table 7-4). Disable output of TO80 (TOE80 (bit 0 of TMC80) =0) and PWM output (PWME80 (bit 6 of TMC80) = 0). Set a count value in CR80. Enable the operation of TM80 (TCE80 = 1).Each time the valid edge specified by bit 1 (TCL800) of TMC80 is input, the value of 8-bit timer counter 80 (TM80)is incremented.When the count value of TM80 matches the value set in CR80, TM80 is cleared to 0 and continues counting. Atthe same time, an interrupt request signal (INTTM80) is generated.Figure 7-5 shows the timing of the external event counter operation (with rising edge specified).Cautions 1. Before rewriting CR80, stop the timer operation. If CR80 is rewritten while the timeroperation is enabled, a match interrupt request signal may be generated immediately at thepoint of rewrite.2. If setting the count clock to TMC80 and enabling the operation of TM80 are performed at thesame time with an 8-bit memory manipulation instruction, the error one cycle after the timerhas been started may exceed one clock. To use 8-bit timer/event counter 80 as an externalevent counter, therefore, make the settings in the above sequence.Figure 7-5. External Event Counter Operation Timing (with Rising Edge Specified)TI80 pin inputTM80 count value00H 01H 02H 03H 04H 05H N – 1 N 00H 01H 02H 03HCR80NTCE80INTTM80RemarkN = 00H to FFHUser’s Manual U14801EJ3V1<strong>UD</strong> 103

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

Saved successfully!

Ooh no, something went wrong!