© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction Purpose This course provides an overview of the standard peripheral.

Slides:



Advertisements
Similar presentations
More fun with Timer/Counters
Advertisements

4-1 Timers Timers can be used for  timing  event counting  pulse width measurement  pulse generation  frequency multiplication There are 8 Timers.
Microcontroller Programming II MP6-1
The 8051 Microcontroller Chapter 5 SERIAL PORT OPERATION.
Digital Logic Chapter 5 Presented by Prof Tim Johnson
EKT 124 / 3 DIGITAL ELEKTRONIC 1
Figure 7–1 Two versions of SET-RESET (S-R) latches
Introduction of Holtek HT-46 series MCU
Counter Circuits and VHDL State Machines
HT46 A/D Type MCU Series Data Memory (Byte) Program Memory HT46R22 (OTP) HT46C22 (Mask) 2Kx Kx16 4Kx HT46R23 (OTP) HT46C23 (Mask) HT46R24.
7-1 Digital Serial Input/Output Two basic approaches  Synchronous shared common clock signal all devices synchronised with the shared clock signal data.
Timers and Interrupts Shivendu Bhushan Summer Camp ‘13.
Chapter 3: Sequential Logic Circuit EKT 121 / 4 ELEKTRONIK DIGIT 1.
INPUT-OUTPUT ORGANIZATION
Serial Peripheral Interface Module MTT M SERIAL PERIPHERAL INTERFACE (SPI)
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Module Introduction Purpose  This training module provides an overview of the different.
SC200x Peripherals Broadband Entertainment Division DTV Source Applications July 2001.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Introduction Purpose:  This training module provides a technical description of Renesas.
Input/Output mechanisms
Renesas Electronics Europe GmbH A © 2010 Renesas Electronics Corporation. All rights reserved. RL78 Clock Generator.
8254 Programmable Interval Timer
1 Chapter 4 Timer Operation (I. Scott MacKenzie).
7/23 Timers in Coldfire Processor Computer Science & Engineering Department Arizona State University Tempe, AZ Dr. Yann-Hang Lee (480)
System Clocks.
16F877A. Timer 0 The Timer0 module timer/counter has the following features: –8-bit timer/counter –Readable and writable –8-bit software programmable.
A Few Words From Dilbert
Chapter 4 TIMER OPERATION
CoE3DJ4 Digital Systems Design Chapter 4: Timer operation.
Unit 10.2 Timer Examples. Example – Music Generation Channel 6 – Set up as a timer Output to Generate Square Waves Channel 4 – Set up as a timer Output.
Universal Synchronous/Asynchronous Receiver/Transmitter (USART)
AT91 Embedded Peripherals
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction Purpose  This course provides an overview of the CPU architecture.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction Purpose This course provides an overview of the peripheral functions.
© 2009, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction  Purpose This course provides an introduction to the peripheral functions.
Advanced Microprocessor1 I/O Interface Programmable Interval Timer: 8254 Three independent 16-bit programmable counters (timers). Each capable in counting.
Example. SBUF Register SCON Register(1) SCON Register(2)
 8251A is a USART (Universal Synchronous Asynchronous Receiver Transmitter) for serial data communication.  Programmable peripheral designed for synchronous.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction Purpose  This training course provides an overview of the CPU architecture.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction Purpose This module provides an overview of sophisticated peripheral.
ATtiny23131 A SEMINAR ON AVR MICROCONTROLLER ATtiny2313.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Module Introduction Purpose  This training module provides an overview of the analog interfaces.
Lecture 12 Multi-Function Timer Pulse Unit 2 (MTU2a)
Microcontrollers Class : 4th Semister E&C and EEE Subject Code: 06ES42
8254 Timer.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction  Purpose:  This course provides an overview of the Direct Memory.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction Purpose  This course provides an overview of the Digital-to-Analog.
Sequential logic circuits
© 2009, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction  Purpose:  This course provides an overview of the serial communication.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction Purpose  This course provides an overview of the PWM type Digital-to-Analog.
© 2009, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction  Purpose This course provides an introduction to the peripheral functions.
1 Timers and Event Counters Lecture In These Notes... We learn the basics of the Timer/Counter peripheral –Called timers by Renesas We examine how.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction Purpose  This course provides an introduction to the peripheral functions.
#1 of 10 Tutorial Introduction PURPOSE -To explain how to configure and use the Timer Interface Module in common applications OBJECTIVES: -Identify the.
Chapter Microcontroller
Timer Programming in Assembly and C Prepared By:
DEPARTMENT OF ELECTRONICS ENGINEERING V-SEMESTER MICROPROCESSOR & MICROCONTROLLER 1 CHAPTER NO microcontroller & programming.
Renesas Electronics Europe GmbH A © 2010 Renesas Electronics Corporation. All rights reserved. RL78 AD converter.
Copyright ©2009 by Pearson Higher Education, Inc. Upper Saddle River, New Jersey All rights reserved. Digital Fundamentals, Tenth Edition Thomas.
1. PIC ADC  PIC18F877 has 8 analog input channels i.e. port A pins(RA0 to RA5) and port E pins(RE1 and RE2). These pins are used as Analog input pins.
Mobile phone keypad sensed password entry for door opening.
Why are Timer Functions Important?
Timers and Event Counters
AVR Addressing Modes Subject: Microcontoller & Interfacing
RX 8-Bit Timer (TMR) 4/20/2011 Rev. 1.00
Introduction to Microprocessors and Microcontrollers
8254 Timer and Counter (8254 IC).
Programmable Interval timer 8253 / 8254
Programmable Interval timer 8253 / 8254
8051 Micro Controller.
8253 – PROGRAMMABLE INTERVAL TIMER (PIT). What is a Timer? Timer is a specialized type of device that is used to measure timing intervals. Timers can.
Presentation transcript:

© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction Purpose This course provides an overview of the standard peripheral functions that the microcontrollers in the M16C series provide. Objectives  Learn about the features and operation of the Programmable I/O ports.  Understand the functions and modes of the various on-chip timers.  Discover how the Serial I/O function operates. Content 28 pages 4 questions Learning Time 40 minutes

© 2008, Renesas Technology America, Inc., All Rights Reserved 2 Programmable I/O Ports Direction Register Port Latch Data Bus I/O Pin Pull Up Selection Digital Input to Peripheral Function Analog Input/Output Basic open drain port CMOS Port Function Select Register Port Control Register

© 2008, Renesas Technology America, Inc., All Rights Reserved 3 I/O Port Registers

© 2008, Renesas Technology America, Inc., All Rights Reserved 5 Up to eleven 16-bit timers with input and output functions All timers can be connected in cascade Various operating modes are available Wide range of applications can be handled  Event Counter  Two-phase Pulse Signal Processing  Pulse Period Measurement  Pulse Width Measurement Input Modes Output Modes  One Shot timer  8-bit PWM output  16-bit PWM output  Three-phase PWM output M16C MCU Highly-Functional On-chip Timers

© 2008, Renesas Technology America, Inc., All Rights Reserved 6 Timer Types, Operating Modes

© 2008, Renesas Technology America, Inc., All Rights Reserved 7 Timer A Reload register Counter Databus high-order bits Databus low-order bits Clock source selection f1 or f2 f8 f32 fc32  Timer  One Shot  PWM  Timer (gate function)  Event Counter Clock selection To external trigger circuit Down count TB2 overflow TA overflow TAk overflow Pulse out TAi Out Clock selection Low-order 8 bits High-order 8 bits Up-count/ Down count (always counts down, except in Event Counter mode) TAi In TABSR register Polarity selection UDF register Toggle flip-flop

© 2008, Renesas Technology America, Inc., All Rights Reserved 8 Timer B Reload register Counter Databus high-order bits Databus low-order bits Clock selection Low-order 8 bits High-order 8 bits Clock source selection f1 or f2 f8 f32 fc32  Timer  Pulse Period Measurement  Pulse Width Measurement  Event Counter TBi IN Can be selected only in Event counter mode TBj overflow TABSR register TBSR register Polarity switching, edge pulse Counter Reset circuit

© 2008, Renesas Technology America, Inc., All Rights Reserved 9 Timer S

© 2008, Renesas Technology America, Inc., All Rights Reserved 10 Timer S

© 2008, Renesas Technology America, Inc., All Rights Reserved 12 FFFF Timer Mode Reload register FFFF Count Start flag (TABSR register) Counter f32 f8 f2 f1 Count Source The timer counts an internally or externally generated count source. Operation: When the timer underflows, it generates an interrupt and toggles an output pin (Timer A only), then reloads the register contents before continuing to count h Timer Mode Register (TAMR or TBMR) 04h h Timer AB Start/Stop Register (TABSR) 01h TAin pin (gate) TAout pin 0000 Timer Interrupt 0002 fc32

© 2008, Renesas Technology America, Inc., All Rights Reserved 13 Event Counter Mode The timer counts an external signal fed to TAi pin. Operation: When the timer underflows, it reloads the register contents before continuing to count. Reload Register FFFF 0 Count Start flag (TABSR register) Counter External Count Source or Under/Overflow from another timer 1 TAi / TBi pin Timer Mode Register (TAMR or TBMR) 00h h h Timer AB Start/Stop Register (TABSR) 01h TAout pin 0000 Timer Interrupt 0002

© 2008, Renesas Technology America, Inc., All Rights Reserved 14 One Shot Timer Mode FFFF 1 0 Count Start flag Counter f2 f32 f8 f1 Count Source 1 Reload register FFFF One-shot Output is high when counting and low when not counting. Reload value determines width of pulse. fc32 Triggered by TAin pin or Overflow/Underflow from another timer TAout pin Timer Mode Register (TAMR or TBMR) 00h06h 00h Timer AB Start/Stop Register (TABSR) 01h The timer, when triggered, outputs one pulse of a specific width.

© 2008, Renesas Technology America, Inc., All Rights Reserved 15 Pulse Width Modulation Mode Count source Trigger is not generated by this signal Input signal to TAiIN pin PWM pulse output from TAiOUT pin IR bit of TAiIC register 1/fi X ( ) Set to “0” upon accepting an interrupt request or by setting bit in software Fj: Frequency of count source (f1, f2, f8, f32, fc32) Note: n = to FFFE16. 1 / fj X n The timer outputs a stream of pulses; each pulse can be set to a specific width.

© 2008, Renesas Technology America, Inc., All Rights Reserved 16 Pulse Period, Width Measurement Count source Measurement pulse Reload register <-- counter transfer timing Timing when counter reaches “0000” Timer Start /Stop bit Interrupt request flag Timer Overflow flag in Mode register Transfer Counter reset to 0000 Transfer Counter reset to 0000 Timer has overflowed The timer measures the pulse period or pulse width of an external signal applied to the TBin pin.

© 2008, Renesas Technology America, Inc., All Rights Reserved 17 Single-Phase Waveform Output Phase Delayed Waveform Output Set/Reset Waveform Output Base timer Waveform Generation register “a+1” Set value Waveform Generation register “a” Set value YYYY (YYYY 16 is the setting value of base timer reset register.) Waveform Generation (Timer S) The timer produces output waveforms whose characteristics are determined by values set in registers. Examples: Single-Phase Waveform output Phase-Delayed output Set/Reset Waveform output

© 2008, Renesas Technology America, Inc., All Rights Reserved 18 Time Measurement (Timer S) INPC1 input pin Base timer 0000 FFFF n p m Time Measurement register m n p Interrupt request bit Cleared by user The timer determines the time elapsed between events.

© 2008, Renesas Technology America, Inc., All Rights Reserved 20 3-Phase Inverter PWM Output Applied to a Motor-Control System 2-phase pulse- signal processing High-speed A/D converter 3-phase inverter PWM output Phase detector (resolver) Motor driver Motor U _U_U V W _V_V __ W Phase A Phase B Current monitoring Encoder signal input M16C MCU NMI Emergency stop signal Position detection TIMERS Three-Phase Motor Control

© 2008, Renesas Technology America, Inc., All Rights Reserved 21 Timer A4 Timer A1 Timer A2 Timer B2 U Phase V Phase W Phase Deadtime Control Phase U Output Control Unit Three-Phase Controller Design

© 2008, Renesas Technology America, Inc., All Rights Reserved 22 Timer A4 Timer A1 Timer A2 Timer B2 U Phase V Phase W Phase Deadtime Control Phase U Output Control Unit Motor

© 2008, Renesas Technology America, Inc., All Rights Reserved 23 Up to 5 serial I/O channels Channels may support: – Both UART (clock-asynchronous) and clock-synchronous modes – Clock-synchronous mode only – Special communications formats (I 2 C, IEBus, SIM) UART/clock-synchronous serial I/O: – Character length: 7/8/9 bits, as selected – Parity bit: select as odd, even, or none – Stop bit: 1 or 2 bits, as selected – 8-bit clock synchronous – I 2 C-bus subset operation is available – IEBus and SIM subset operation also available Clock synchronous serial I/O: – 8-bit clock synchronous MCU SI03 SI04 UART2 UART0 UART1 M16C MCU Bi-directional data communications supported. Serial I/O

© 2008, Renesas Technology America, Inc., All Rights Reserved 24 Transmitter IC Receiver IC RxD TxD Clk Receiver/Transmitter IC #1 RxD TxD Connection example for synchronous communication Connection example for asynchronous communication Baud rates and Baud Rate Generator settings in UART mode f8 f1 Baud Rate (bps) BRG’s Count source System clock: 16MHz BRG’s set value:n Actual time (bps) MHz Actual time (bps) BRG’s set value:n 207(CF 16 ) 51(33 16 ) 103(67 16 ) 95(5F 16 ) 23(17 16 ) 45(2F 16 ) f1 51(33 16 ) 23(17 16 ) f1 25(19 16 ) 11(0b 16 ) f1 16(10 16 ) 07(08 16 ) CTSRTS CTS RTS CTS Receiver/Transmitter IC #2 (Maximum data rate in clock synchronous mode: 5M bits per second) In the UART asynchronous mode, data rates up to and above 57,600 bits per second are achievable, especially with M16C system clock frequencies above 16MHz or with special crystal frequencies chosen to minimize bit error rates. In the clock synchronous mode, the maximum date rate is 5 Megabits per second. This limit is determined by the receive-data setup and hold time in the M16C MCU, plus the external clock input’s minimal cycle time, which is 200 nanoseconds at 5V. Connections, Baud Rates

© 2008, Renesas Technology America, Inc., All Rights Reserved 25 UART Channel

© 2008, Renesas Technology America, Inc., All Rights Reserved 26 Clock Synchronous Channel 1/(n+1) Baud Rate Generator register CLK i Main Clock, PLL or Ring Oscillator 1/8 1/4 f1SIO or f2SIO f8SIO f32SIO 1/2 SIO counter i Synchronous circuit Databus SI/O interrupt request SIO counter i Sout i Sin i 8 LSBMSB Clock Polarity Reversing ckt 1/2 If the clock source is chosen to be external, then the clock is input from the CLKi pin.

© 2008, Renesas Technology America, Inc., All Rights Reserved 28 Course Summary Programmable I/O ports Timers Serial I/O