Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction Purpose This course provides an overview of the standard peripheral."— Presentation transcript:

1 © 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

2 © 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

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

4

5 © 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

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

7 © 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

8 © 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

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

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

11

12 © 2008, Renesas Technology America, Inc., All Rights Reserved 12 FFFF Timer Mode Reload register FFFF 0002 0 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. 1 0001 00h Timer Mode Register (TAMR or TBMR) 04h 0002 00h Timer AB Start/Stop Register (TABSR) 01h TAin pin (gate) TAout pin 0000 Timer Interrupt 0002 fc32

13 © 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 0002 05h 0001 00h Timer AB Start/Stop Register (TABSR) 01h TAout pin 0000 Timer Interrupt 0002

14 © 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 021010210FFFF 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 0002 00010000 0002 The timer, when triggered, outputs one pulse of a specific width.

15 © 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 (2 16 -1) 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 = 000016 to FFFE16. 1 / fj X n The timer outputs a stream of pulses; each pulse can be set to a specific width.

16 © 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.

17 © 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 16 0000 16 (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

18 © 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.

19

20 © 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

21 © 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

22 © 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

23 © 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

24 © 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 9600 2400 600 f8 f1 Baud Rate (bps) BRG’s Count source System clock: 16MHz BRG’s set value:n Actual time (bps) 7.3728MHz 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 ) 601 2404 9615 600 2400 9600 19200 f1 51(33 16 ) 23(17 16 ) 19231 19200 38400 f1 25(19 16 ) 11(0b 16 ) 38461 38400 57600 f1 16(10 16 ) 07(08 16 ) 58823 57600 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

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

26 © 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.

27

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


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

Similar presentations


Ads by Google