logo image - link to home page

Products | Support | Resources | PurchaseContact  | Basket  | Checkout

  Home
  What's New
  Products
  Distributors
  Purchasing Info
  Developer Resources
  Support
  Upgrades
  Site Index
  Contact Us
  Pb-Free Info (RoHS)
 

 

keyword search:
 


 

Products:
  Books:
    The LAB-X1 Tutorial and Resource Book
    PICBASIC PROJECTS - 30 Projects Using PICBASIC and PICBASIC PRO
    Programming PIC Microcontrollers With PICBASIC
    Running Small Motors with PIC™ Microcontrollers
    Making PIC™ based Laboratory Instruments and Controllers
    Serial Port Complete Second Edition
    USB Complete Third Edition
    Build Your Own Humanoid Robots
    PIC Robotics
    Insectronics : Build Your Own Walking Robot
    Amphibionics : Build Your Own Biologically Inspired Reptilian Robot
    Designing Embedded Systems with PIC Microcontrollers: Principles and Applications
    Easy Microcontrol'n - A Beginner's Guide to Using PIC16/17 Microcontrollers
    Easy Step'n - An Introduction to Stepper Motors for the Experimenter
    PIC Microcontroller Project Book
    Microcontrol'n Apps - PIC Microcontroller Applications Guide
    Time'n and Count'n using PIC® Microcontrollers
    Programming and Customizing PICmicro Microcontrollers
    Serial Communications
     

Time'n and Count'n using PIC® Microcontrollers - $34.95

Purchase at mcumart.com

(replaces PIC'n Techniques)

by David Benson

"Time'n and Count'n" © is an intermediate level book on 16-bit timing and counting applications using Microchip Technology's PIC® microcontrollers. More opportunities for creating fun projects are described. Learning to use timer 1 (TMR1) with it's powerful capture, compare and pulse width modulation (PWM) modes will expand your PIC microcontroller design capabilities significantly. TMR1, which is an on-board feature of many of the mid-range PIC microcontrollers, is a 16-bit timer/counter. The maximum count is 65,535 vs. 255 for timer 0 (TMR0). This is a big help! TMR1 used in conjunction with the capture, compare, PWM (CCP) module may be programmed to do useful things unattended leaving the PIC free to perform other tasks. A special pin may be used for external inputs to TMR1 and another special pin may be used as an external output from TMR1. The techniques presented in the book are useful for generating single time intervals and free running outputs as well as for measuring period and frequency. PWM using TMR1 unattended is also described. These timing and counting techniques serve as the basis for designing and building your own period and frequency generating and measuring test equipment as described in the book. 

This book gives example programs in assembly language only.

8-1/2 x 11 format, 218 pages.


Table of Contents
INTRODUCTION

TEST EQUIPMENT FOR TIMING AND COUNTING EXPERIMENTS

Test equipment for detecting a short single pulse and measuring it's width
Pulse generator - 32 microseconds
Pulse generator - 128 microseconds
Pulse generator - 2000 microseconds
Pulse generator - 65280 microseconds
Test equipment for generating a frequency output
USING TIMER 1, TIMER 2 AND THE CAPTURE/COMPARE/PWM (CCP) MODULE

PIC16F870 test circuit
Before we take off
TMR2: 8-bit timer
TMR2 description
How to choose/select mode of operation
Interrupts
TMR2 applications
   Free running mode (via TMR2 interrupt)
   Free running mode (via period register)
TMR1: 16-bit timer/counter and capture/compare module
TMR1/CCP module simplified
TMR1 description
CCP module - capture mode
CCP module - compare mode
CCP module - PWM mode
How to choose/select mode of operation
   T1CON register
   CCP1CON register
Interrupts
Reading and writing TMR1
Long time intervals
Controlling the CCP1 pin in compare mode
More than one way to do timing stuff
Timing and counting experiments
Free running output (via TMR1 interrupt)
Event counting (via TMR1)
   Count events, read TMR1 contents
   Capture TMR1 count when external event occurs
   Count events up to predetermined number and generate an output (compare)
Single time interval output (via TMR1 and CCP, compare mode)
   Start TMR1, auto end
      500 milliseconds
      128 microseconds
Free running output (via TMR1 and CCP, compare mode)
      Clear TMR1 each cycle
      Free running TMR1, add interval value to compare register each cycle
Time measurement (period/interval/time between events)
      (via TMR1 read)(interval input via port pin)
      (via TMR1 and CCP, capture mode)(interval input via CCP1 pin,
      two captures,subtract)
Frequency measurement (via TMR1, gate via TMR0)
External 32,768 Hz watch crystal-based clock for TMR1
Pulse width modulation (PWM) using TMR2 and the CCP module
Analog output - increase/decrease buttons - PWM - 8-bit mode
Duty cycle - 10-bit mode
Analog output - increase/decrease buttons - PWM - 10-bit mode
DESIGNING AND BUILDING YOUR OWN TEST EQUIPMENT
 

Keypad/LCD user interface

5-digit decimal to 16-bit binary entry program
Using the 5-digit decimal to 16-bit binary entry program
Digital pulse generator
Digital frequency generator
Time interval measurement instrument
Frequency measurement instrument
Creating your own combination signal generator and measurement instrument

APPENDIX A - Program listings vs. page number

APPENDIX B - PICF870 control registers

APPENDIX C - '84 on a board

APPENDIX D - PIC/LCD schematic and code

APPENDIX E - Keypad

APPENDIX F - Using the ICD

APPENDIX G - Sources
 

Copyright 2008
microEngineering Labs, Inc.
Box 60039
Colorado Springs CO 80960
(719) 520-5323
(719) 520-1867 fax
email: support@melabs.com

Last Updated: 03/21/2008

Home | What's New | Products | Support
Resources
| Purchase | Index Contact

PIC, PICmicro, dsPIC, and  MPLAB are registered trademarks of Microchip Technology Inc. in the USA and other countries.  PICBASIC, PICBASIC PRO, PICPROTO, and EPIC are trademarks of Microchip Technology Inc. in the USA and other countries.   BASIC Stamp is a trademark of Parallax, Inc.

Microchip third-party partner  Microchip Consultant Program Member