Application Note. Synchronous Operation Mode

Similar documents
Application Note. Watchdog Timer

In timer mode, choose functions from those listed in Table 1. Operations of the circled items are described below.

M32C/84, 85, 86, 87, 88 Group

Operation of Timer A (2-phase pulse signal process in event counter mode, multiply-by-4 processing operation)

This document describes a program for timer RA in pulse period measurement mode.

This document describes a program for timer RF in pulse width measurement mode.

RTE/L Return from Exception Handling with Data Restoration

AVR134: Real Time Clock (RTC) Using the Asynchronous Timer. Features. Introduction. AVR 8-bit Microcontrollers APPLICATION NOTE

M32C/84, 85, 86, 87, 88 Group

SH7144/45 Group APPLICATION NOTE. 2-Phase Encoder Count. 1. Specifications

Data Transfer between On-chip RAM Areas with DMAC (Burst Mode) 1. Introduction Description of Sample Application... 3

Old Company Name in Catalogs and Other Documents

1. Specifications Conditions for Application Description of Modules Used Description of Operation... 7

M3H Group(2) Application Note Asynchronous Serial Communication Circuit (UART-C)

Old Company Name in Catalogs and Other Documents

Base Timer Channel (BT) Features. General Description. When to Use a PDL_BT Component 1.0

Nano102/112 Series Errata Sheet

ATECC108/ATSHA204 USER GUIDE. Atmel Firmware Library. Features. Introduction

AT11512: SAM L Brown Out Detector (BOD) Driver. Introduction. SMART ARM-based Microcontrollers APPLICATION NOTE

Picture cell driver for STN (LCD driver)

APPLICATION NOTE. AT05567: TC Capture on External Interrupt with the Event System on SAM D20. Preface ASF PROJECT DOCUMENTATION

H8SX Family APPLICATION NOTE. Vector Table Address Switching. Introduction. Target Devices. Contents

APPLICATION NOTE. Atmel AVR1638: XMEGA RTC Calibration. 8-bit Atmel Microcontrollers. Features. Introduction

The following article describes how to use the M16C/62 timers A s as square wave generators (Pulse Output Mode).

However, if an event comes in when the new value is being written to the pulse accumulator counter, that event could be missed. One solution to this p

S1C17 Family EEPROM Emulation Library Manual

M16C/26 APPLICATION NOTE. Implementing Real Time Clock and WAIT Mode. 1.0 Abstract. 2.0 Introduction. 3.0 Real-Time Clock Setup and Implementation

Old Company Name in Catalogs and Other Documents

UM0792 User manual. Demonstration firmware for the DMX-512 communication protocol transmitter based on the STM32F103Zx.

M16C/62 APPLICATION NOTE. Using the M16C/62 DMAC in Forward Source Mode. 1.0 Abstract. 2.0 Introduction

ATAES132A Firmware Development Library. Introduction. Features. Atmel CryptoAuthentication USER GUIDE

AN2592 Application note

Old Company Name in Catalogs and Other Documents

One 32-bit counter that can be free running or generate periodic interrupts

M16C/26 APPLICATION NOTE. Using Timer B in Pulse Period/Width Measurement Mode. 1.0 Abstract. 2.0 Introduction

AN3996 Application Note

SAM4 Reset Controller (RSTC)

Hello and welcome to this Renesas Interactive module that covers the Independent watchdog timer found on RX MCUs.

M3H Group(2) Application Note 12-bit Analog to Digital Converter (ADC-A)

Automatic reload of the period to the count register on terminal count

AVR42772: Data Logger Demo Application on XMEGA A1U Xplained Pro. Introduction. Features. AVR XMEGA Microcontrollers APPLICATION NOTE

EDBG. Description. Programmers and Debuggers USER GUIDE

1. Specification Applicable Conditions Description of Modules Used Principles of Operation... 9

APPLICATION NOTE. Atmel AVR057: Internal RC Oscillator Calibration for ATtiny4/5/9/10/20/40. 8-bit Atmel Microcontrollers. Features.

Ethernet1 Xplained Pro

Fujitsu Microelectronics Europe Application Note MCU-AN E-V10 FR FAMILY 32-BIT MICROCONTROLLER MB91460 REAL TIME CLOCK APPLICATION NOTE

M16C/26 APPLICATION NOTE. Using the DMAC with a Forward Source. 1.0 Abstract. 2.0 Introduction

Old Company Name in Catalogs and Other Documents

C Language Programming, Interrupts and Timer Hardware

S1C17 Family Port Nested Interrupt Application Notes

AT10942: SAM Configurable Custom Logic (CCL) Driver. Introduction. SMART ARM-based Microcontrollers APPLICATION NOTE

Product Update. Errata to Z8 Encore! 8K Series Silicon. Z8 Encore! 8K Series Silicon with Date Codes 0402 and Later

APPLICATION NOTE. AT11008: Migration from ATxmega16D4/32D4 Revision E to Revision I. Atmel AVR XMEGA. Introduction. Features

timer 1 Fri Oct 13 13:00:

SPI Overview and Operation

Taking the LPC800 into the delta quadrant :)

Old Company Name in Catalogs and Other Documents

3. Absolute Maximum Ratings (Note) (Unless otherwise specified, T a = 25 ) Symbol V ESD. P PK I PP T j T stg

AN3279 Application Note

ECE3120: Computer Systems Chapter 8: Timer Module

STA bit single chip baseband controller for GPS and telematic applications. Features

DF10G7M1N DF10G7M1N. 1. Applications. 2. Packaging and Internal Circuit Rev.5.0. Start of commercial production

Capable of adjusting detection timings for start bit and data bit

16-Bit Hardware Density Modulated PWM Data Sheet

C Language Programming, Interrupts and Timer Hardware

MN101E50 Series. 8-bit Single-chip Microcontroller

ESP8266 Application Note Firmware Download Protocol

DF2S6.8FS DF2S6.8FS. 1. Applications. 2. Packaging and Internal Circuit Rev.5.0. Start of commercial production.

APPLICATION NOTE. AT04470: Differences between SAM D21 Variants A, B, and L. 32-bit Microcontroller. Introduction

STM8 I 2 C optimized examples

CE PSoC 4: Time-Stamped ADC Data Transfer Using DMA

This application note describes the time measurement function of Timer S with the gate function.

Dual PLL frequency synthesizer

EE 308 Spring A software delay

AN-8205 AMC Library Hall Interface Summary AMC Introduction

Oscillation stop detection circuit included

Flash Self-programming Library

AT09381: SAM D - Debugging Watchdog Timer Reset. Introduction. SMART ARM-based Microcontrollers APPLICATION NOTE

Fujitsu Microelectronics Europe Application Note MCU-AN E-V10 F²MC-FR FAMILY 32-BIT MICROCONTROLLER MB91460 RELOAD TIMER APPLICATION NOTE

This document describes how to set up and use the timer RA in timer mode on the R8C/25 Group device.

Engineering Bulletin. Introduction and Background. Definition of Early TOF EB389/D 11/2001

This input determines the next value of the output. The output does not change until the next rising edge of the clock.

PPG Function of F2MC-16LX MCU Series as PWM

Table of Figures Figure 1. High resolution PWM based DAC...2 Figure 2. Connecting the high resolution buck converter...8

AN3980 Application note

Asynchronous Transfer of Data with Appended CRC Codes via an SCI Interface

EFM32 Zero Gecko EFM32ZG Errata

Emulating I2C Bus Master by using FlexIO

M3H Group(1) Application Note. I 2 C Interface (I2C-B) MASTER/SLAVE

IP-48DAC channel 16-bit Digital/Analog Converter With memory Industry Pack Module PROGRAMMING MANUAL Version 1.

AN Entering ISP mode from user code. Document information. ARM ISP, bootloader

DGILib USER GUIDE Atmel-42771A-DGILib_User Guide-09/2016

ME 4447 / ME 6405: Introduction to Mechatronics

M16C/26 APPLICATION NOTE. Using the M16C/26 Timer in Event Counter Mode. 1.0 Abstract. 2.0 Introduction

This document describes how to set up and use the timer RB in programmable one-shot generation mode on the R8C/25 Group device.

AT06467: Getting started with SAM D09/D10/D11. Features. Description. SMART ARM-based Microcontrollers APPLICATION NOTE

Optional Pause Pulse for constant frame length of 282 clock ticks

AT60142H/HT. Rad-Hard 512Kx8 Very Low Power CMOS SRAM ERRATA-SHEET. Active Errata List. Errata History. Abbreviations. 1.

QT3 Xplained Pro. Preface. Atmel QTouch USER GUIDE

EE4390 Microprocessors. Lessons 2, 3 68HC12 Hardware Overview, Subsystems, and memory System

Transcription:

Application Note Synchronous Operation Mode For H8/3694 series Contact Info: Brazen Tek, Inc. 20121 Ventura Blvd. Suite 310 Woodland Hills, CA 91364 USA Tel/Fax: (818) 710-9262 E-mail: info@brazentek.com November 2008

Introduction One of the functionality of Timer W is to generate waveforms based on pulse width techniques. This application is to describe Timer W based on synchronous mode to obtain PWM waveforms as output. Target Device H8/3694 group Contents 1. Specifications 3 2. Description of Functions Used..3 3. Description of Operations..5 4. Description of Software.5 4.1 Description of Modules..5 4.2 Description of Arguments..5 4.3 Description of Internal Registers.6 4.4 Description of RAM.6 5. Flowcharts.7 6. Program Listing 8 2

1. Specifications i. Deploy Timer W based on synchronous mode to obtain PWM waveforms as output. ii. The output pulses generated by half of their cycle, otherwise known as high-level widths are to control their duty cycle. iii. Settings in registers would enable complete duty cycle variation between 0% and 100%. Duty Cycle = High level pulse width Pulse Period 100(%) FTIOB Pulse Period High-level pulse width FTIOC High-level pulse width Figure 1 PWM waveforms 2. Description of Functions used This application note is to PWM waveforms generated by Timer W in synchronous mode. Figure 2 shows the block diagram of this operation. The following functions are being used: - Counter clearing function upon an output compare. - Two channels 0 and 1 of Timer W are used to generate PWM waveforms. 3

Counter clear Timer control Input Timer status Signal generator Register Clock register (TCRW) (TSRW) General register A (GRA) General register B (GRB) Timer counter (TCNT) Comparator A Comparator B Timer Control Output control Timer interrupt register W enable register W (TCRW) (TIERW) Timer I/O Control register 0 (TIOR0) PWM waveforms Figure 2 Timer W synchronous operation mode 4

3. Description of Operations TCNT values GRA GRB GRC GRD H 000 Time FTIOB FTIOC Figure 3 Synchronous operation of Timer W 4. Description of Software 4.1 Description of Modules Table 4.1 describes the firmware used in this App. Note. Module Name Label Name Function Main main Sets timing of general registers. Using Synchronous operation, it generates PWM waveforms 4.2 Description of Arguments None are used for this AN. Table 4.1 - Description of Modules 5

4.3 Description of Internal Registers Table 4.2 describes the internal registers used in this AN. Register /Name TSRW TCNT Function Enables/Disables Channels 0 or 1 counter timer operation Timer counter TMRW TCRW TIOR0 TIERW GRA GRB GRC GRD Set for synchronous operation mode Triggers input clock and resets channel 0 of timer counter Enables/Disables timer output Sets initial output value when output compare has occurred Sets a duty cycle for one of the PWM waveforms Sets a duty cycle for one of the PWM waveforms Sets a period for one of the PWM waveforms Sets a period for one of the PWM waveforms Table 4.2 - Internal Registers 4.4 Description of RAM None used for this AN 6

5. Flowcharts Main Clear TSRW bit 0 Select the input clock Counter clearing selected by GRA TMRW selects the synchronous operation mode Clear TCRW Initialize TCNT Set duty cycle/period for registers to generate PWM waveforms Timer output enabled by TIOR0 Start TCNT counting 7

6. Program Listing Initialize source (Program list).export_init.import_main ;.SECTION P,CODE _INIT: MOV.W #H'FF80,R7 LDC.B #B'10000000,CCR JMP @_main ;.END /* */ /* H8/3694 group MCU */ /* Application Note */ /* */ /* 'Synchronous Operation Mode' */ /* */ /* :Timer W Synchronous Mode */ /* */ /* External Clock: 16 MHz */ /* Internal Clock: 16 MHz */ /* Sub Clock: 32.768kHz */ /* */ #include <machine.h> /* Symbol Definition */ struct BIT { unsigned char b7:1; /* bit7 */ unsigned char b6:1; /* bit6 */ unsigned char b5:1; /* bit5 */ unsigned char b4:1; /* bit4 */ unsigned char b3:1; /* bit3 */ unsigned char b2:1; /* bit2 */ unsigned char b1:1; /* bit1 */ 8

unsigned char b0:1; /* bit0 */ }; #define TCRW *(volatile unsigned char *)H FF81 /* Timer Control Register W */ #define TIOR0 *(volatile unsigned char *)H FF84 /* Timer I/O Control Register 0 */ #define TIOR1 *(volatile unsigned char *)H FF85 /* Timer I/O Control Register 1 */ #define TSRW *(volatile unsigned char *)H FF83 /* Timer Status Register W */ #define IMIFA_0 TSR_0_BIT.b0 /* Input Capture/Compare match Flag A Channel 0 */ #define TIERW *(volatile unsigned char *)H FF82 /* Timer Interrupt Enable Register W */ #define TCNT *(volatile unsigned short *)H FF86 /* Timer Counter */ #define GRA *(volatile unsigned short *)H FF88 /* General Register A */ #define GRB *(volatile unsigned short *)H FF8A /* General Register B */ #define GRC *(volatile unsigned short *)H FF8C /* General Register C */ #define GRD *(volatile unsigned short *)H FF8E /* General Register D */ #define TMRW *(volatile unsigned char *)H FF80 /* Timer Mode Register W */ /* Function Definition */ extern void INIT ( void ); /* SP Set */ void main ( void ); extern void _INITSCT(); /************************************************************/ /* Vector Address */ /************************************************************/ #pragma section V1 /* VECTOR SECTION SET */ void (*const VEC_TBL1[])(void) = { /* H 00 H 0F */ INIT /* 00 Reset }; #pragma section /* P */ /**********************************************************/ /* Main Program */ /**********************************************************/ void main ( void ) 9

{ _INITSCT(); set_imask_ccr(1); /* Disable interrupts */ TSRW = H FC; /* Timer Stop */ TIOR0 = H 00; /* PWM initial output "0" */ TCRW = H 20; /* GRA Compare match Clear Mode */ GRA = H 320; /* Period: Cycle 50us */ GRB = H 230; /* Duty cycle 30% */ GRC = H 230; /* Duty cycle 30% */ GRD = H 230; /* Duty cycle 30% */ TIERW = H F1; /* FTIOB, FTIOC, FTIOD Output Enable */ TSRW = H FD; /* TCNT Start */ set_imask_ccr(0); /* Interrupt Enable */ while(1) { ; } } 10

Important Notes 1. This document is provided for reference purposes only. Brazen Tek neither makes warranties or representations with respect to the accuracy or completeness of the information contained in this document nor grants any license to any intellectual property rights. 2. Brazen Tek shall have no liability for damages or infringement of any intellectual property or other rights arising out of the use of any information in this document, including, but not limited to, product data, diagrams, charts, programs, algorithms, and application circuit examples. 3. This application note or the technology described in this document is not for the purpose of military applications such as the development of weapons of mass destruction or for the purpose of any other military use. 4. Brazen Tek assumes no liability whatsoever for any damages incurred as a result of errors or omissions in the information included in this document. 5. When using or otherwise relying on the information in this document, you should evaluate the information in light of the total system before deciding about the applicability of such information to the intended application. Brazen Tek makes no representations, warranties or guaranties regarding the suitability of its products for any particular application and specifically disclaims any liability arising out of the application and use of the information in this document. 12. This document may not be reproduced or duplicated, in any form, in whole or in part, without prior written approval from Brazen Tek.