INPUT CAPTURE WITH ST62 16-BIT AUTO-RELOAD TIMER

Similar documents
AN1324 APPLICATION NOTE

8-BIT MCU WITH SINGLE VOLTAGE FLASH MEMORY, DATA EEPROM, ADC, TIMERS, SPI

Application Support. Product Information. Omron STI. Support Engineers are available at our USA headquarters from

Safety Relay Unit G9SB

WE SERIES DIRECTIONAL CONTROL VALVES

Safety Relay Unit G9SB

Chapter 5. Synchronous Sequential Logic. Outlines

STA2051E VESPUCCI 32-BIT SINGLE CHIP BASEBAND CONTROLLER FOR GPS AND TELEMATIC APPLICATIONS 1 FEATURES. Figure 1. Packages

Chapter 3: Sequential Logic Design -- Controllers

Panel-mounted Thermostats

Design and Implementation of Timer, GPIO, and 7-segment Peripherals

GRABLINKTM. FullTM. - DualBaseTM. - BaseTM. GRABLINK Full TM. GRABLINK DualBase TM. GRABLINK Base TM

Introduction. APPLICATION NOTE 712 DS80C400 Ethernet Drivers. Jun 06, 2003

ST10F273M Errata sheet

ECE 274 Digital Logic. Digital Design. Datapath Components Registers. Datapath Components Register with Parallel Load

Explosion protected add-on thermostat

ECE 274 Digital Logic. Digital Design. Sequential Logic Design Controller Design: Laser Timer Example

AN2415 Application note

Scans and encodes up to a 64-key keyboard. DB 1 DB 2 DB 3 DB 4 DB 5 DB 6 DB 7 V SS. display information.

AT03716: Implementation of SAM L Configurable Custom Logic (CCL) Peripheral. Description. SMART ARM-based Microcontrollers APPLICATION NOTE

Corporate Logo Guidelines

Obsolete Product(s) - Obsolete Product(s)

Soft Error Derating Computation in Sequential Circuits

Point System (for instructor and TA use only)

VISUAL IDENTITY GUIDE

STEVAL-IKR001V7D. Sub Ghz transceiver daughterboard with power amplifier based on the SPIRIT1. Features. Description

Answers to Exercise 3.3 (p. 76)

DESCRIPTION High voltage Schottky rectifier suited for SLIC protection during the card insertion operation. SOT-23 (Plastic)

Using the Synchronized Pulse-Width Modulation etpu Function by:

Hello, and welcome to this presentation of the STM32 system window watchdog. It will cover the main features of this peripheral used to detect

AN4178 Application note

400 Series Flat Panel Monitor Arm

The Official IDENTITY SYSTEM. A Manual Concerning Graphic Standards and Proper Implementation. As developed and established by the

lookbook Transportation - Airports

TEA6425 VIDEO CELLULAR MATRIX

92.507/1. EYR 203, 207: novaflex universal controller. Sauter Systems

UM1596 User manual. STM8 based universal motor control example software. Introduction

GM69010H DisplayPort, HDMI, and component input receiver Features Applications

Notations Used in This Guide

Explorer Edition FUZZY LOGIC DEVELOPMENT TOOL FOR ST6

AN2421 Application note

L7208. Portable consumer electronics spindle and VCM motor controller. General features. Spindle driver. Description. VCM driver.

Microcontrollers. Outline. Class 4: Timer/Counters. March 28, Timer/Counter Introduction. Timers as a Timebase.

STEVAL-IHT005V2. Demonstration board with full 3.3 V ACS/Triac control using the STM32F100. Description. Features

HCF40193B PRESETTABLE UP/DOWN COUNTERS (DUAL CLOCK WITH RESET) BINARY TYPE

Synchronising Word Problem for DFAs

GM68020H. DisplayPort receiver. Features. Applications

M68HC11 Timer. Definition

Engineer To Engineer Note

lookbook Higher Education

BLDC DRIVE USING AN OPTICAL ENCODER

Notations Used in This Guide

ECE 4510/5530 Microcontroller Applications Week 3 Lab 3

CPE 200L LABORATORY 2: DIGITAL LOGIC CIRCUITS BREADBOARD IMPLEMENTATION UNIVERSITY OF NEVADA, LAS VEGAS GOALS:

Multi-channel LED driver with integrated boost controller for medium, large LCD panel backlight based on LED7708 and STM32F103C6T6A

GM60028H. DisplayPort transmitter. Features. Applications

HCF4027B DUAL J-K MASTER SLAVE FLIP-FLOP

Chapter 1: Introduction

IEC compliant smart meter system for AMI applications based on STM32, ST7570 PLM, and STPMC1/STPMS1 chipset

4.3 8 bit TFT Digital Driver Board Specification

Avaya P460. Quick Start Guide. Important Information. Unpack the Chassis. Position the Chassis. Install the Supervisor Module and PSU

AN3023 Application note

Logic Analyzer Triggering Techniques to Capture Elusive Problems

A scalable approach to your body, networking and security platforms. Description. Table 1. Device summary

Published in A R DIGITECH

Design and Implementation of an AHB VGA Peripheral

Analog/digital watch Multi frequency reception, 4 digit LCD, 3 hands. Preliminary Specification

bit TFT Digital Driver Board Specification

Obsolete Product(s) - Obsolete Product(s)

Obsolete Product(s) - Obsolete Product(s)

Obsolete Product(s) - Obsolete Product(s)

o The 9S12 has a 16-bit free-running counter to determine the time and event happens, and to make an event happen at a particular time

Contents 2. Notations Used in This Guide 6. Introduction to Your Projector 7. Using Basic Projector Features 28. Setting Up the Projector 15

o The 9S12 has a 16-bit free-running counter to determine the time and event happens, and to make an event happen at a particular time

L9822E OCTAL SERIAL SOLENOID DRIVER

Mask Set Errata for Mask 1M07J

STDP4020. DisplayPort receiver. Features. Applications

Lecture 3: Circuits & Layout

DLP Pico Chipset Interface Manual

Obsolete Product(s) - Obsolete Product(s)

STEVAL-ILL015V1. High brightness RGB LED array with LED error detection based on the STP24DP05 and STM32. Features. Description

LCD Data Projector VPL-S500U/S500E/S500M

The following document contains information on Cypress products.

ADC Peripheral in Microcontrollers. Petr Cesak, Jan Fischer, Jaroslav Roztocil

MILWAUKEE ELECTRONICS NEWS

Radio Clock with DCF77

Lecture 14: Computer Peripherals

An Enhanced MM MHz Generator

MODEL: 40DPT. Digital Panel Meters 40 Series. [3] OPTIONS blank: none /Q: With options (specify the specification)

EECS145M 2000 Midterm #1 Page 1 Derenzo

STA3005. Dual-IF AM/FM digital radio receiver. Feature summary. Order codes

Laboratory Exercise 4

VGA Port. Chapter 5. Pin 5 Pin 10. Pin 1. Pin 6. Pin 11. Pin 15. DB15 VGA Connector (front view) DB15 Connector. Red (R12) Green (T12) Blue (R11)

Menu. 68HC12 Timer Block Diagram EEL 3744 EEL Input Capture (IC)

Slide 1. Flip-Flops. Cross-NOR SR flip-flop S R Q Q. hold reset set not used. Cross-NAND SR flip-flop S R Q Q. not used reset set hold 1 Q.

Applications. NCO Clock Generator 1. Fine freq. adjustment. Synthesizer 0. Fine freq. adjustment. Synthesizer 1 Fs= Bs 1. *Ks 1. *16*Ms 1.

Main components Proximity and ambient light sensing (ALS) module

SR-750 Series. A New Compact 2D Code Reader. that enables stable reading of difficult codes. Compact 2D Code Reader. SR-750 Series.

Agilent 5345A Universal Counter, 500 MHz

TV Synchronism Generation with PIC Microcontroller

Transcription:

APPLICATION NOTE INPUT CAPTURE WITH ST62 -BIT AUTO-RELOAD TIMER by -bit Micro Appliction Tem 1 INTRODUCTION This note presents how to use the ST62 -bit Auto-Relod Timer (ARTimer) to mesure durtions or frequencies of n input signl. An exmple shows how to cpture n input signl to mke n output signl with the sme frequency s input signl but with duty cycle equl to 50%. 1.1 BIT AUTO-RELOAD TIMER DESCRIPTION This timer is -bit downcounter timer with prescler (see Figure 1.). It includes uto-relod PWM, cpture nd compre cpbility with two input(cp1,cp2) nd two output pins(ovf,pwm). It is controlled by the following registers ( bit): Sttus control registers (SCR1, SCR2, SCR3, SCR4) Cpture register high (CPH) nd low (CPL). For the totl -bit the register is CP. Msk register high (MASKH) nd low (MASKL). For the totl -bit the register is MASK. Decrementl counter register (TC with -bit) Compre register high (CMPH) nd low (CMPL). For the totl -bit the register is CMP. Relod/Cpture register high (RLCPH) nd low (RLCPL). For the totl -bit the register is RLCP. AN1050/109 1/9 1

The prescler rtio cn be progrmmed to choose the timer input frequency f int (see Tble 1 ). Figure 1. -bit Auto-Relod Timer Block Digrm -BIT MCU DATA BUS SCR1 SCR2 SCR3 SCR4 BUS INTERFACE -BIT DATA BUS CMP MASK RLCP CP PSC rtio f int Compre Compre to 0 TC f osc PWM OVF INT CONTROL LOGIC CP1 CP2 2/9

1.2 CAPTURE MODE This cn be used to mesure time durtion or frequencies (see Figure 2.).This mode is used to mesure the time elpsed between two edges of one or two externl signl. Ech edge cou be rising or flling depend on initilistion. With the -bit TC downcounter nd with f osc to Mhz, signl of 4ms durtion cn be mesured with resolution of 1/3276. Exmple: Let's mesure the time elpsed between two rising edges on CP2: The -bit CP vlue contins the time between the two CP2 rising edges nd will be divided by two to be loded in the -bit CMP register. The cpture mode uses the CP2 triggered restrt mode with CP2 event detection (RDSEL2=1, RDSEL1=0 of SCR2 register). It s men tht ech CP2 edge sets off the cpture of the TC vlue in the CP register nd then relods TC register with the RLCP vlue. The CP2 interrupt is enbled (CP2IEN=1 of SCR3 register) nd CMP interrupt is enbled (CMPIEN=1 of SCR3 register) to mnge the output bit PA2. In the CP2 interrupt sub-progrm the output bit PA2 is set to 1. In the CMP interrupt sub-progrm the output bit PA2 is set to 0. The min progrm clcultes the division by 2 of the cptured -bit vlue nd sves it in NewCMPh nd NewCMPl. The prescler rtio must be progrmmed ccording to the expected durtion to mesure. In this exmple it is progrmmed to: prescler rtio =, clock source = f osc = Mhz. The period to mesure must be in the rnge of 250µs to 133ms. The shring of -bit dt between the min progrm nd the interrupt sub-progrm obliges to disble the interruption for ech hndling of this dt in the min progrm. This cuses jitters of up to 30µs. The dely between the input signl ctive edge nd the output signl is of 36µs. The RLCP register is lod with FFFFh to void subtrction to clculte the dely between the CP2 edge nd the compre vlue reched by the TC vlue. Tble 1. Prescler Progrmming Rtio PSC2 PSC1 PRESCALER Rtio 0 0 Clock Disbled 0 1 1 1 0 4 1 1 3/9

Figure 2. TC, CP nd CMP vlue evolution synchronized with the input CP2. CP2 CP vlue CMP vlue= previous CP vlue divide by 2 relod t TC register 0 t MASK&TC=MASK&CMP cpture PA2 bit ouput t 4/9

Progrm exmple **************ST6230 Auto-Relod -bit Cpture mode ****************** object: Give n output TTL squre siqnl t the sme frequency of the no symmetricl TTL input signl input : TTL signl in the rnge of 7.5Hz to 4000Hz on CP2 output: TTL signl with the sme frequency of CP2 but with duty cycle of 50%. The signl hs dely of 36µs nd jitters of 30µs with clock frequency of Mhz. uthor: Jen-Luc CREBOUW.vers "st6230".romsize dt registers ***.input "623x.sm" dt RAM *** templ.def 04h ; low byte of the divider by two temph.def 05h ; high byte of the divider by two NewCMPl.def 06h ; low byte of the result divider NewCMPh.def 07h ; high byte of the result divider dt.def 0h ; dt copy of the A port sve_cpl.def 09h ; sve the CP hight sve_cph.def 0h ; sve the CP low ************************ INITIALIZATION *********************************.org 00h reset ART Initilistion *** i SCR1,0F0h ; prescl by to hve f int =.5 Mhz ; Relod mode ; Runres ; No interrupt with overflow ; Reset mode for OVFMD i SCR2,02h ; CP1 input interrupt disble ; CP2 triggered restrt mode with CP2 event ; detection i SCR3,0D0h ; CP2 polrity with rising edge 5/9

; CP2 interrupt enble ; Compre interrupt enble ; Compre to zero interrupt disble i SCR4,0h ; Overflow output disble ;PWM output disble i RLCPH,0FFh ; RLCP register to FFFFh i RLCPL,0FFh ; i CMPH,0FFh ; CMP register to FF00h i CMPL,000h ; i MASKH,0FFh ; MASK = 0FFFFh i MASKL,0FFh PortA initilistion for output bit 2 nd CP2 input i ddr,04h i or,04h clr dt, ; dt = 0 GENERAL INTERRUPT *** i ior,10h ;Enbles ll interrupts. **************************Min progrm******************************** ********divide the CP vlue by two to lod CMP register with ********** PULSE: red the previous cpture out of interrupt to void sve_cpl nd sve_cph from different CP vlue i ior,00h ; disbles ll interrupts.,sve_cpl templ,,sve_cph i ior,10h ; Enbles ll interrupts. temph, divide by two temp (-bit) clr,templ templ, clr,temph 6/9

temph, jrnc no_1,templ ddi,00h templ, no_1:,temph ddi,00h temph,,templ store the next CMP vlue out of interrupt i ior,00h ; disbles ll interrupts. NewCMPl,,temph NewCMPh, i ior,10h ; Enbles ll interrupts. jp PULSE ***********************End of Min progrm**************************** ***********************UART IT mngement***************************** it_urt: x, ; sve if compre interrupt jrs 5,SCR3,it_cp2,dt ; output port PA2 = 0 dr, set 2,dt ; dt bit 2 = 1 res 3,SCR3 ; reset CMPFLG,x ; restore it_cp2: else CP2 interrupt,dt ; output port PA2 = 1 dr, res 2,dt ; dt bit 2 = 0 res 5,SCR3 ; reset CP2FLG 7/9

res 5,SCR2 ; reset CP2ERR,CPH ; red CP register nd sve the -bit vlue sve_cph, ; in sve_cph nd sve_cpl,cpl sve_cpl,,newcmph CMPH, ; store NewCMPh nd NewCMPl in CMP to hve,newcmpl ; CMP = previous CP / 2 CMPL,,x ; restore ********************End of UART IT mngement************************* ***************** Restrt nd interrupt Vectors ************************.org 0ff0h ; FF0h jp it_urt ; FF2h ; FF4h ; FF6h.org 0ffch nmi nop res jp reset /9

"THE PRESENT NOTE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT OF SUCH A NOTE AND/OR THE USE MADE BY CUSTOMERS OF THE INFORMATION CONTAINED HEREIN IN CONNEXION WITH THEIR PRODUCTS." Informtion furnished is believed to be ccurte nd relible. However, STMicroelectronics ssumes no responsibility for the consequences of use of such informtion nor for ny infringement of ptents or other rights of third prties which my result from its use. No license is grnted by impliction or otherwise under ny ptent or ptent rights of STMicroelectronics. Specifictions mentioned in this publiction re subject to chnge without notice. This publiction supersedes nd replces ll informtion previously supplied. STMicroelectronics products re not uthorized for use s criticl components in life support devices or systems without the express written pprovl of STMicroelectronics. The ST logo is registered trdemrk of STMicroelectronics 199 STMicroelectronics - All Rights Reserved. Purchse of I 2 C Components by STMicroelectronics conveys license under the Philips I 2 C Ptent. Rights to use these components in n I 2 C system is grnted provided tht the system conforms to the I 2 C Stndrd Specifiction s defined by Philips. STMicroelectronics Group of Compnies Austrli - Brzil - Cnd - Chin - Frnce - Germny - Itly - Jpn - Kore - Mlysi - Mlt - Mexico - Morocco - The Netherlnds - Singpore - Spin - Sweden - Switzerlnd - Tiwn - Thilnd - United Kingdom - U.S.A. http://www.st.com 9/9