This course provides an overview of the standard peripheral functions that the microcontrollers in the M16C series provide.

Similar documents
Serial Communications

8051 Serial Port. Crystal TXD. I/O Device RXD. Embedded Systems Peripherals

Atmel Norway XMEGA Introduction

Timer A (0 and 1) and PWM EE3376

Chapter 9 Latches, Flip-Flops, and Timers

Experiment # 9. Clock generator circuits & Counters. Eng. Waleed Y. Mousa

a8251 Features General Description Programmable Communications Interface

Lab Experiment 1: The LPC 2148 Education Board

CHAPTER 11: Flip Flops

UART IP Core Specification. Author: Jacob Gorban

ARM Thumb Microcontrollers. Application Note. Software ISO 7816 I/O Line Implementation. Features. Introduction

ETEC 2301 Programmable Logic Devices. Chapter 10 Counters. Shawnee State University Department of Industrial and Engineering Technologies

NTE2053 Integrated Circuit 8 Bit MPU Compatible A/D Converter

CoE3DJ4 Digital Systems Design. Chapter 4: Timer operation

Using Xbee in Serial Communication

Objectives. Basics of Serial Communication. Simplex vs Duplex. CMPE328 Microprocessors (Spring ) Serial Interfacing. By Dr.

1. Learn about the 555 timer integrated circuit and applications 2. Apply the 555 timer to build an infrared (IR) transmitter and receiver

Digital Systems Based on Principles and Applications of Electrical Engineering/Rizzoni (McGraw Hill

AVR Timer/Counter. Prof Prabhat Ranjan DA-IICT, Gandhinagar

DECT Module UM-9802 Datasheet

USB2.0 <=> I2C V4.4. Konverter Kabel und Box mit Galvanischetrennung

DS1621 Digital Thermometer and Thermostat

Section 14. Compare/Capture/PWM (CCP)

PART B QUESTIONS AND ANSWERS UNIT I

Develop a Dallas 1-Wire Master Using the Z8F1680 Series of MCUs

USART and Asynchronous Communication

Design and Implementation of Home Monitoring System Using RF Technology

USER GUIDE EDBG. Description

Flexible Active Shutter Control Interface using the MC1323x

AVR305: Half Duplex Compact Software UART. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

ETEC Digital Controls PIC Lab 10 Pulse Width Modulation

Counters and Decoders

PCAN-MicroMod Universal I/O Module with CAN Interface. User Manual. Document version ( )

Serial Communications

LC7218, 7218M, 7218JM

Flash Microcontroller. Memory Organization. Memory Organization

Real-Time Clock. * Real-Time Computing, edited by Duncan A. Mellichamp, Van Nostrand Reinhold

PFB366 Profibus-DP Gateway User Manual

AVR317: Using the Master SPI Mode of the USART module. 8-bit Microcontrollers. Application Note. Features. Introduction

Bluetooth Audio Data Transfer between Bluetooth chipset (PMB6752&PMB6625) and TriCore Host TC1920

Part Number Description Packages available

Module 3: Floyd, Digital Fundamental

Hello, and welcome to this presentation of the STM32L4 reset and clock controller.

AVR151: Setup and Use of the SPI. Introduction. Features. Atmel AVR 8-bit Microcontroller APPLICATION NOTE

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING Question Bank Subject Name: EC Microprocessor & Microcontroller Year/Sem : II/IV

Software User Guide UG-461

8254 PROGRAMMABLE INTERVAL TIMER

LINDY ELECTRONICS LIMITED & LINDY-ELEKTRONIK GMBH - SECOND EDITION

To design digital counter circuits using JK-Flip-Flop. To implement counter using 74LS193 IC.

ULC Technology: High-performance gate array package using multiple metal layer CMOS technology featuring sub-micron channel lengths (0.

Chapter 8. Sequential Circuits for Registers and Counters

Counters & Shift Registers Chapter 8 of R.P Jain

Section 17. UART HIGHLIGHTS UART. This section of the manual contains the following major topics:

Having read this workbook you should be able to: recognise the arrangement of NAND gates used to form an S-R flip-flop.

ASYNCHRONOUS COUNTERS

DS1104 R&D Controller Board

DIGITAL ELECTRONICS. Counters. By: Electrical Engineering Department

The enable pin needs to be high for data to be fed to the outputs Q and Q bar.

Block 3 Size 0 KB 0 KB 16KB 32KB. Start Address N/A N/A F4000H F0000H. Start Address FA000H F8000H F8000H F8000H. Block 2 Size 8KB 16KB 16KB 16KB

Manual Serial PCI Cards

AVR131: Using the AVR s High-speed PWM. Introduction. Features. AVR 8-bit Microcontrollers APPLICATION NOTE

Serial port interface for microcontroller embedded into integrated power meter

CHAPTER 11 LATCHES AND FLIP-FLOPS

Using the HT46R46 I/O Ports to Implement Half-Duplex SPI Communication

B Robo Claw 2 Channel 5A Motor Controller Data Sheet

RS - SPM. Serial parallel translator module

The Programming Interface

Application Note 83 Fundamentals of RS 232 Serial Communications

1/22/16. You Tube Video. Definitions. Duty Cycle: on-time per period (specified in per cent)

Microcomputer Protocol Implementation at Local Interconnect Network Georgi Krastev

HT1632C 32 8 &24 16 LED Driver

Pmod peripheral modules are powered by the host via the interface s power and ground pins.

DS1621 Digital Thermometer and Thermostat

ADS9850 Signal Generator Module

Flip-Flops and Sequential Circuit Design. ECE 152A Winter 2012

Flip-Flops and Sequential Circuit Design

Data Acquisition Module with I2C interface «I2C-FLEXEL» User s Guide

DP8570A DP8570A Timer Clock Peripheral (TCP)

ET-BASE AVR ATmega64/128

Contents COUNTER. Unit III- Counters

Computer Organization and Components

Master/Slave Flip Flops

Memory Elements. Combinational logic cannot remember

Below is a diagram explaining the data packet and the timing related to the mouse clock while receiving a byte from the PS-2 mouse:

8051 MICROCONTROLLER COURSE

RS-422/485 Multiport Serial PCI Card. RS-422/485 Multiport Serial PCI Card Installation Guide

AT15007: Differences between ATmega328/P and ATmega328PB. Introduction. Features. Atmel AVR 8-bit Microcontrollers APPLICATION NOTE

Sequential Logic Design Principles.Latches and Flip-Flops

Eliminate Risk of Contention and Data Corruption in RS-485 Communications

AN4646 Application note

BINARY CODED DECIMAL: B.C.D.

SPI. Overview and Use of the PICmicro Serial Peripheral Interface. Getting Started: SPI

AVR32788: AVR 32 How to use the SSC in I2S mode. 32-bit Microcontrollers. Application Note. Features. 1 Introduction

A Lesson on Digital Clocks, One Shots and Counters

Freescale Semiconductor, Inc. Product Brief Integrated Portable System Processor DragonBall ΤΜ

RETRIEVING DATA FROM THE DDC112

Microprocessor & Assembly Language

Debouncing Switches. Mechanical switches are one of the most common interfaces to a uc.

Decimal Number (base 10) Binary Number (base 2)

Transcription:

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 1

Programmable I/O Ports Pull Up Selection Direction Register Function Select Register Port Control Register Data Bus Port Latch I/O Pin Input to Peripheral Function Analog Input/Output Basic open drain port CMOS Port 2

I/O Port Registers 3

PROPERTIES On passing, 'Finish' button: On failing, 'Finish' button: Allow user to leave quiz: User may view slides after quiz: User may attempt quiz: Goes to Next Slide Goes to Slide After user has completed quiz After passing quiz Unlimited times

Highly-Functional On-chip Timers 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 Input Modes Output Modes Event Counter Two-phase Pulse Signal Processing Pulse Period Measurement Pulse Width Measurement M16C MCU One Shot timer 8-bit PWM output 16-bit PWM output Three-phase PWM output 5

Timer Types, Operating Modes 6

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

Timer B Databus high-order bits f1 or f2 f8 Clock source ion f32 fc32 Timer Pulse Period Measurement Pulse Width Measurement Event Counter Clock ion Databus low-order bits Low-order 8 bits Reload Counter High-order 8 bits TBi IN Polarity switching, edge pulse TABSR TBSR Can be ed only in Event counter mode Counter Reset circuit TBj overflow 8

Timer S Request by matching G1BTRR & base timer Request by matching G1PO0 & base timer BTS Request from INT1 pin Base timer reset f1 or f2 Two-phase pulse input BCK1 to BCK0 Divider Base timer Base timer overflow request Base timer reset Base timer reset request Base timer interrupt INPC10 INPC11 G1TM0, G1PO0 G1TM1, G1PO1 PWM output OUTC10 OUTC11 INPC12 INPC13 G1TM2, G1PO2 G1TM3, G1PO3 PWM output OUTC12 OUTC13 INPC14 INPC15 G1TM4, G1PO4 G1TM5, G1PO5 PWM output OUTC14 OUTC15 INPC17 INPC16 debounce Gate function Gate function Prescaler function Prescaler function G1TM6, G1PO6 G1TM7, G1PO7 PWM output OUTC16 OUTC17 9 Interrupt request signal

Timer S Request by matching G1BTRR & base timer Request by matching G1PO0 & base timer BTS Request from INT1 pin Base timer reset f1 or f2 Two-phase pulse input BCK1 to BCK0 Divider Base timer Base timer overflow request Base timer reset Base timer reset request Base timer interrupt INPC10 INPC11 G1TM0, G1PO0 G1TM1, G1PO1 PWM output OUTC10 OUTC11 INPC12 INPC13 G1TM2, G1PO2 G1TM3, G1PO3 PWM output OUTC12 OUTC13 INPC14 INPC15 G1TM4, G1PO4 G1TM5, G1PO5 PWM output OUTC14 OUTC15 INPC17 INPC16 debounce Gate function Gate function Prescaler function Prescaler function G1TM6, G1PO6 G1TM7, G1PO7 PWM output OUTC16 OUTC17 10 Interrupt request signal

PROPERTIES On passing, 'Finish' button: On failing, 'Finish' button: Allow user to leave quiz: User may view slides after quiz: User may attempt quiz: Goes to Next Slide Goes to Slide After user has completed quiz After passing quiz Unlimited times

Timer Mode 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 contents before continuing to count. Timer Mode Register (TAMR or TBMR) 00h 04h Timer AB Start/Stop Register (TABSR) 00h 01h Reload FFFF 0002 Count Source f1 f2 f8 f32 fc32 TAin pin (gate) 0 1 FFFF 0001 0000 0002 Counter Count Start flag (TABSR ) 12 TAout pin Timer Interrupt

Event Counter Mode The timer counts an external signal fed to TAi pin. Operation: When the timer underflows, it reloads the contents before continuing to count. Timer Mode Register (TAMR or TBMR) 00h 05h Timer AB Start/Stop Register (TABSR) 00h 01h Reload Register FFFF 0002 TAi / TBi pin 10 FFFF 0001 0000 0002 Counter Timer Interrupt External Count Source or Under/Overflow from another timer Count Start flag (TABSR ) 13 TAout pin

One Shot Timer Mode The timer, when triggered, outputs one pulse of a specific width. Timer Mode Register (TAMR or TBMR) 00h 06h Timer AB Start/Stop Register (TABSR) Count Source f1 f8 f32 f2 fc32 00h 01h Count Start flag 01 Reload FFFF 0002 FFFF 0001 0000 0002 021010210 Counter TAout pin Triggered by TAin pin or Overflow/Underflow from another timer 14 One-shot Output is high when counting and low when not counting. Reload value determines width of pulse.

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

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

Waveform Generation (Timer S) The timer produces output waveforms whose characteristics are determined by values set in s. Examples: Single-Phase Waveform output Phase-Delayed output Set/Reset Waveform output Base timer Waveform Generation a+1 Set value Waveform Generation a Set value YYYY 16 (YYYY 16 is the setting value of base timer reset.) 0000 16 Single-Phase Waveform Output Phase Delayed Waveform Output Set/Reset Waveform Output 17

Time Measurement (Timer S) The timer determines the time elapsed between events. INPC1 input pin FFFF Base timer n p m 0000 Time Measurement m n p Interrupt request bit Cleared by user 18

PROPERTIES On passing, 'Finish' button: On failing, 'Finish' button: Allow user to leave quiz: User may view slides after quiz: User may attempt quiz: Goes to Next Slide Goes to Slide After user has completed quiz After passing quiz Unlimited times

Three-Phase Motor Control 3-Phase Inverter PWM Output Applied to a Motor-Control System M16C MCU NMI Emergency stop signal TIMERS 3-phase inverter PWM output U _ U V _ V Motor driver 2-phase pulsesignal processing High-speed A/D converter W W Phase A Phase B Encoder signal input Current monitoring Phase detector (resolver) Position detection Motor 20

Three-Phase Controller Design Timer B2 Deadtime Control Timer A4 Phase U Output Control Unit U Phase Timer A1 Timer A2 V Phase W Phase 21

Motor Timer B2 Deadtime Control Timer A4 Phase U Output Control Unit U Phase Timer A1 Timer A2 V Phase W Phase 22

Serial I/O 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) Bi-directional data communications supported. UART/clock-synchronous serial I/O: Character length: 7/8/9 bits, as ed Parity bit: as odd, even, or none Stop bit: 1 or 2 bits, as ed 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 MCU UART0 UART1 M16C MCU UART2 SI03 SI04 MCU MCU MCU 23

Connections, Baud Rates Transmitter IC Receiver IC Receiver/Transmitter IC #1 Receiver/Transmitter IC #2 RxD TxD Clk CTS RTS RxD TxD Clk RTS CTS RxD TxD CTS RTS RxD TxD RTS CTS Connection example for synchronous communication (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. Baud Rate (bps) 2400 9600 24 Connection example for asynchronous communication Baud rates and Baud Rate Generator settings in UART mode BRG s Count source 600 f8 f8 f1 System clock: 16MHz BRG s set value:n 207(CF 16 ) 51(33 16 ) 103(67 16 ) Actual time (bps) 601 2404 9615 BRG s set value:n 95(5F 16 ) 23(17 16 ) 45(2F 16 ) 7.3728MHz Actual time (bps) 600 2400 9600 19200 f1 51(33 16 ) 19231 23(17 16 ) 19200 38400 f1 25(19 16 ) 38461 11(0b 16 ) 38400 57600 f1 16(10 16 ) 58823 07(08 16 ) 57600

UART Channel Main Clock, PLL or Ring Oscillator 1/2 1/8 f1sio or f2sio f8sio (UARTx) RxD0 RxD polarity reversing circuit 1/4 f32sio TxD0 f1sio or f2sio f8sio f32sio Baud Rate Generator Internal 1/(n0+1) External 1/16 (Clock Synchronous type) 1/16 UART reception UART transmission Clock Synchronous type Reception Control Circuit Transmission Control Circuit Receive clock Transmit clock Transmit/ Receive Unit Clock Synchronous type (when internal clock ed) 1/2 Clock Synchronous type (when internal clock ed) Clock Synchronous type (when external clock ed) CLKO Clock Polarity Reversing ckt CTS/ RTS disabled CTS/RTS RTS CTS from other UART 25

Clock Synchronous Channel If the clock source is chosen to be external, then the clock is input from the CLKi pin. 1/2 f1sio or f2sio Databus Main Clock, PLL or Ring Oscillator 1/8 1/4 f8sio f32sio Synchronous circuit 1/2 1/(n+1) Baud Rate Generator CLK i Clock Polarity Reversing ckt SIO counter i SI/O interrupt request Sout i LSB MSB Sin i SIO counter i 8 26

PROPERTIES On passing, 'Finish' button: On failing, 'Finish' button: Allow user to leave quiz: User may view slides after quiz: User may attempt quiz: Goes to Next Slide Goes to Slide After user has completed quiz After passing quiz Unlimited times

Course Summary Programmable I/O ports Timers Serial I/O 28