LOGICIEL EMBARQUE LA GESTION DU COUNTER/TIMER

Documents pareils
Instructions pour mettre à jour un HFFv2 v1.x.yy v2.0.00

IPSAS 32 «Service concession arrangements» (SCA) Marie-Pierre Cordier Baudouin Griton, IPSAS Board

Exercices sur SQL server 2000

Surveillance de Scripts LUA et de réception d EVENT. avec LoriotPro Extended & Broadcast Edition

Gestion des prestations Volontaire

Les Portfolios et Moodle Petit inventaire

Instructions Mozilla Thunderbird Page 1

MICROCONTROLEURS PIC PROGRAMMATION EN C. V. Chollet - cours-pic-13b - 09/12/2012 Page 1 sur 44

Exemple PLS avec SAS

Le No.1 de l économie d énergie pour patinoires.

Editing and managing Systems engineering processes at Snecma

Contents Windows

First Nations Assessment Inspection Regulations. Règlement sur l inspection aux fins d évaluation foncière des premières nations CONSOLIDATION

How to Login to Career Page

WEB page builder and server for SCADA applications usable from a WEB navigator

Once the installation is complete, you can delete the temporary Zip files..

Cheque Holding Policy Disclosure (Banks) Regulations. Règlement sur la communication de la politique de retenue de chèques (banques) CONSOLIDATION

sur le réseau de distribution

Improving the breakdown of the Central Credit Register data by category of enterprises

Contrôle d'accès Access control. Notice technique / Technical Manual

Monitor LRD. Table des matières

UML : Unified Modeling Language

APPENDIX 6 BONUS RING FORMAT

Conférence sur les microcontroleurs.

3615 SELFIE. HOW-TO / GUIDE D'UTILISATION

GAME CONTENTS CONTENU DU JEU OBJECT OF THE GAME BUT DU JEU

Application Form/ Formulaire de demande

English Q&A #1 Braille Services Requirement PPTC Q1. Would you like our proposal to be shipped or do you prefer an electronic submission?

DOCUMENTATION - FRANCAIS... 2

Paxton. ins Net2 desktop reader USB

Support Orders and Support Provisions (Banks and Authorized Foreign Banks) Regulations

Software and Hardware Datasheet / Fiche technique du logiciel et du matériel

Thank you for choosing the Mobile Broadband USB Stick. With your USB Stick, you can access a wireless network at high speed.

Material Banking Group Percentage Regulations. Règlement fixant le pourcentage (groupe bancaire important) CONSOLIDATION CODIFICATION

RAPID Prenez le contrôle sur vos données

Notice Technique / Technical Manual

Interest Rate for Customs Purposes Regulations. Règlement sur le taux d intérêt aux fins des douanes CONSOLIDATION CODIFICATION

Lesson Plan Physical Descriptions. belle vieille grande petite grosse laide mignonne jolie. beau vieux grand petit gros laid mignon

Utiliser une WebCam. Micro-ordinateurs, informations, idées, trucs et astuces

Ships Elevator Regulations. Règlement sur les ascenseurs de navires CODIFICATION CONSOLIDATION. C.R.C., c C.R.C., ch. 1482

Archived Content. Contenu archivé

Institut français des sciences et technologies des transports, de l aménagement

RULE 5 - SERVICE OF DOCUMENTS RÈGLE 5 SIGNIFICATION DE DOCUMENTS. Rule 5 / Règle 5

Stratégie DataCenters Société Générale Enjeux, objectifs et rôle d un partenaire comme Data4

AUDIT COMMITTEE: TERMS OF REFERENCE

Comprendre l impact de l utilisation des réseaux sociaux en entreprise SYNTHESE DES RESULTATS : EUROPE ET FRANCE

Conférence Bales II - Mauritanie. Patrick Le Nôtre. Directeur de la Stratégie - Secteur Finance Solutions risques et Réglementations

MapReduce. Malo Jaffré, Pablo Rauzy. 16 avril 2010 ENS. Malo Jaffré, Pablo Rauzy (ENS) MapReduce 16 avril / 15

Supervision et infrastructure - Accès aux applications JAVA. Document FAQ. Page: 1 / 9 Dernière mise à jour: 15/04/12 16:14

XtremWeb-HEP Interconnecting jobs over DG. Virtualization over DG. Oleg Lodygensky Laboratoire de l Accélérateur Linéaire

SA-32 / SA-62 INSTRUCTION MANUAL - MANUEL D INSTRUCTIONS

Appointment or Deployment of Alternates Regulations. Règlement sur la nomination ou la mutation de remplaçants CONSOLIDATION CODIFICATION

Thank you for choosing the Mobile Broadband USB Stick. With your USB Stick, you can access a wireless network at high speed.

NTP (Network Time Protocol)

Technologies quantiques & information quantique

ARCHOS Activity Tracker

Master4Light. Caractérisation Optique et Electrique des Sources Lumineuses. Equipement 2-en-1 : source de courant et spectrophotomètre

INVESTMENT REGULATIONS R In force October 1, RÈGLEMENT SUR LES INVESTISSEMENTS R En vigueur le 1 er octobre 2001

Loi sur l aide financière à la Banque Commerciale du Canada. Canadian Commercial Bank Financial Assistance Act CODIFICATION CONSOLIDATION

DOCUMENTATION - FRANCAIS... 2

Règlement relatif à l examen fait conformément à la Déclaration canadienne des droits. Canadian Bill of Rights Examination Regulations CODIFICATION

Copyright 2014, Oracle and/or its affiliates. All rights reserved.

Chapitre VIII : Journalisation des événements

Short-term Pooled Investment Fund Regulations. Règlement sur le fonds commun de placement à court terme CONSOLIDATION CODIFICATION

L ESPACE À TRAVERS LE REGARD DES FEMMES. European Economic and Social Committee Comité économique et social européen

FOURTH SESSION : "MRP & CRP"

JSIam Introduction talk. Philippe Gradt. Grenoble, March 6th 2015

LOI SUR LA RECONNAISSANCE DE L'ADOPTION SELON LES COUTUMES AUTOCHTONES ABORIGINAL CUSTOM ADOPTION RECOGNITION ACT

Quick Start Guide This guide is intended to get you started with Rational ClearCase or Rational ClearCase MultiSite.

Calculation of Interest Regulations. Règlement sur le calcul des intérêts CONSOLIDATION CODIFICATION. Current to August 4, 2015 À jour au 4 août 2015

POLICY: FREE MILK PROGRAM CODE: CS-4

SCHOLARSHIP ANSTO FRENCH EMBASSY (SAFE) PROGRAM APPLICATION FORM

Borrowing (Property and Casualty Companies and Marine Companies) Regulations

Name Use (Affiliates of Banks or Bank Holding Companies) Regulations

TABLE DES MATIERES A OBJET PROCEDURE DE CONNEXION

Outils d'analyse de la sécurité des réseaux. HADJALI Anis VESA Vlad

Credit Note and Debit Note Information (GST/ HST) Regulations

22/09/2014 sur la base de 55,03 euros par action

LE FORMAT DES RAPPORTS DU PERSONNEL DES COMMISSIONS DE DISTRICT D AMENAGEMENT FORMAT OF DISTRICT PLANNING COMMISSION STAFF REPORTS

Compléter le formulaire «Demande de participation» et l envoyer aux bureaux de SGC* à l adresse suivante :

Consultants en coûts - Cost Consultants

Le passé composé. C'est le passé! Tout ça c'est du passé! That's the past! All that's in the past!

I. Programmation I. 1 Ecrire un programme en Scilab traduisant l organigramme montré ci-après (on pourra utiliser les annexes):

Spécial Catégorie 6 Patch Cords

calls.paris-neuroscience.fr Tutoriel pour Candidatures en ligne *** Online Applications Tutorial

Forthcoming Database

Order Binding Certain Agents of Her Majesty for the Purposes of Part 1 of the Personal Information Protection and Electronic Documents Act

Frequently Asked Questions

Utiliser un proxy sous linux

DOCUMENTATION - FRANCAIS... 2

Life Companies Borrowing Regulations. Règlement sur les emprunts des sociétés d assurance-vie CONSOLIDATION CODIFICATION

WINTER BOAT STORAGE SYSTEM SYSTÈME DE REMISAGE HIVERNAL POUR BATEAU

USB 598. Quick Start Guide (Windows) Guide de démarrage rapide (Windows) USB Modem. Modem USB.

DOCUMENTATION MODULE BLOCKCATEGORIESCUSTOM Module crée par Prestacrea - Version : 2.0

Principe de TrueCrypt. Créer un volume pour TrueCrypt

General Import Permit No. 13 Beef and Veal for Personal Use. Licence générale d importation n O 13 bœuf et veau pour usage personnel CONSOLIDATION

Comment Accéder à des Bases de Données MySQL avec Windows lorqu'elles sont sur un Serveur Linux

Folio Case User s Guide

NEW Fin Fan / Air cooled condenser cleaning

Transcription:

LOGICIEL EMBARQUE LA GESTION DU COUNTER/TIMER Finalité Technologie de l Informatique Haute Ecole Namur Liège Luxembourg

LA GESTION DU COUNTER/TIMER Un compteur/minuteur (counter/timer) est un périphérique qui permet : De compter des évènements extérieurs: Passages de personnes dans un local, Passage de pièces dans une unité de production De générer une référence de temps (horloge) De générer une interruption après un laps de temps défini Création d un OS (callback function) De chronométrer un temps séparant deux évènements : Mesure de la vitesse d un arbre moteur Mesure de la période d un signal Mesure d un rapport cyclique De générer des signaux MLI (PWM) Commande de moteur, Eclairage 2 Haute Ecole Namur Liège Luxembourg

LA GESTION DU COUNTER/TIMER Le PIC 18F46K22 contient : 1 Timer0 (counter / Timer) Mode 8 ou 16 bits Diviseur de fréquence (3 bits) Interruption en overflow 3 Timers (1/3/5) (counter / Timer) Mode 16 bits Source d horloge externe ou interne + Diviseur de fréquence (2 bits) Interruption en overflow Possibilité de compter des évènements externes Base de temps pour les fonctions «Capture/Compare» 3 Timers (2/4/6) (Only Timer) Mode 8 bits Diviseur de fréquence (2 bits) Interruption (TMRx match with Prx) 3 Haute Ecole Namur Liège Luxembourg

Overflow Mode 4 Haute Ecole Namur Liège Luxembourg

Capture Mode In capture operation, the CCP module copy the contents of a timer into a capture register on an signal edge. 5 Haute Ecole Namur Liège Luxembourg

Compare Mode In compare operation, the CCP module compares the contents of a CCPR register with that of Timer in every clock cycle. When these two registers are equal, the associated pin may be pulled to high, or low, or toggled. 6 Haute Ecole Namur Liège Luxembourg

Compare Mode 7 Haute Ecole Namur Liège Luxembourg

Pulse Width Modulation (PWM) In PWM mode, the CCP module can be configured to generate a waveform with certain frequency and duty cycle. 8 Haute Ecole Namur Liège Luxembourg

Pulse Width Modulation (PWM) 9 Haute Ecole Namur Liège Luxembourg

Pulse Width Modulation (PWM) 10 Haute Ecole Namur Liège Luxembourg

Pulse Width Modulation (PWM) 11 Haute Ecole Namur Liège Luxembourg

TIMER0 Can be configured as an 8-bit or 16-bit timer or counter. Can select the internal instruction cycle clock or the T0CKI signal as the clock signal. The user can choose to divide the clock signal by a prescaler before connecting it to the clock input to Timer0. An interrupt may be requested when Timer rolls over from 0xFFFF to 0x0000 The T0CON register controls the operation of Timer0. 12 Haute Ecole Namur Liège Luxembourg

TIMER0 13 Haute Ecole Namur Liège Luxembourg

TIMER0 14 Haute Ecole Namur Liège Luxembourg

TIMER0 15 Haute Ecole Namur Liège Luxembourg

TIMER0 16 Haute Ecole Namur Liège Luxembourg

TIMER0 17 Haute Ecole Namur Liège Luxembourg

TIMER0 Example : Write a subroutine to create a time delay that is equal to 100 ms time value x assuming that the crystal oscillator is running at 32 MHz. Solution : 1.Place the value 15535 into the TMR0 high byte and the TMR0L register so that Timer0 will overflow in 50000 clock cycles. 2.Choose instruction cycle clock as the clock source and set the prescaler to 16 so that Timer0 will roll over in 100 ms. 3.Enable Timer0. 4. Wait until Timer0 to overflow 18 Haute Ecole Namur Liège Luxembourg

TIMER0 Langage C 19 Haute Ecole Namur Liège Luxembourg

TIMER1/3/5 Is a 16-bit timer/counter. An interrupt may be requested when Timer1 rolls over from 0xFFFF to 0x0000. Timer1/3/5 can be reset when the CCP module is configured to compare mode to generate a special event trigger. Timer1/3/5 operation is controlled by the T1CON register. Timer1/3/5 can be configured to use the oscillator connected to the T1OSO and T1OSI pins. The Timer1/3/5 oscillator is primarily intended for a 32 KHz crystal. Timer1/3/5 can be used to create time delays and measure the frequency (period) of an unknown signal. 20 Haute Ecole Namur Liège Luxembourg

TIMER1/3/5 «Gate Mode» 21 Haute Ecole Namur Liège Luxembourg

TIMER1/3/5 «Gate Mode» 22 Haute Ecole Namur Liège Luxembourg

TIMER1/3/5 Timer Mode 23 Haute Ecole Namur Liège Luxembourg

TIMER1/3/5 Counter Mode 24 Haute Ecole Namur Liège Luxembourg

TIMER1/3/5 Example :Use Timer0 as a timer to create a one-second delay and use Timer1 as a counter to count the rising (or falling) edges of an unknown signal (at the T1CKI pin) arrived in one second which would measure the frequency of the unknown signal. Write a program to implement this idea assuming that the PIC18 MCU is running with a 32MHz crystal oscillator. Solution: A one-second delay can be created by placing 10 in cx and calling the delay function in Example 2. Timer1 should be configured as follows: 16-bit mode prescaler value set to 1 disable oscillator do not synchronize external clock input select external T1CKI pin signal as the clock source Timer1 may overflow many times in one second The user must enable the Timer1 overflow interrupt and keep track of the number of times that it interrupts. 25 Haute Ecole Namur Liège Luxembourg

TIMER1/3/5 The setting of Timer1 interrupt is as follows: Enable priority interrupt Place Timer1 interrupt at high priority Enable only Timer1 roll-over interrupt Langage C 26 Haute Ecole Namur Liège Luxembourg

TIMER1/3/5 27 Haute Ecole Namur Liège Luxembourg

TIMER2/4/6 8-bit timer TMR2 and 8-bit period register PR2. TMR2 is counting up and comparing with PR2 in every clock cycle. When TMR2 equals PR2, the TMR2 is reset. A postscaler is applied to the reset signal to generate the TMR2 interrupt. The TMR2 output is fed to the synchronous serial port module. The operation of Timer2 is controlled by T2CON register. 28 Haute Ecole Namur Liège Luxembourg

TIMER2/4/6 29 Haute Ecole Namur Liège Luxembourg

TIMER2/4/6 30 Haute Ecole Namur Liège Luxembourg

TIMER2/4/6 Example : Assume that the PIC18F46k22 is running with a 32 MHz crystal oscillator. Write an instruction sequence to generate periodic interrupts every 8 ms with high priority using Timer2. Solution: By setting the prescaler and postscaler to 16 and loading 249 into the PR2 register, Timer2 will generate periodic interrupt every 8 ms: 31 Haute Ecole Namur Liège Luxembourg

LA GESTION DU COUNTER/TIMER Le microcontrôleur est cadencé à une horloge de 1 MHz. Configurer les bits des registres appropriés qui permettent de générer une interruption toutes les 200 ms. Les bits des registres liés à la gestion des interruptions ne sont pas à considérer ici. Ecrire suivant le format xxxxbits.yyyyy = (1 ou 0)) 32 Haute Ecole Namur Liège Luxembourg

Bibliographie 33 Haute Ecole Namur Liège Luxembourg