DM163045 Microchip Technology, DM163045 Datasheet - Page 33

no-image

DM163045

Manufacturer Part Number
DM163045
Description
PICDEM Lab Development Kit (with PICkit 3) General Purpose
Manufacturer
Microchip Technology
Series
PICDEM™r
Type
MCUr
Datasheet

Specifications of DM163045

Contents
Board, PIC kit 3
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
For Use With/related Products
PIC Micro® MCU

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
DM163045
Manufacturer:
MICROCHIP
Quantity:
12 000
© 2009 Microchip Technology Inc.
3.3.6
3.3.6.1
To configure the peripherals used in this lab, the following registers are used:
1. Timer0 Module Register: TMR0
2. OPTION Register: OPTION_REG (Register 5-1 in Section 5 of the PIC16F690
3. Software configurable prescaler to determine the number of clock source edge
4. Interrupt Control Register: INTCON (Register 2-3 in Section 2 of the PIC16F690
3.3.6.2
To implement a more accurate delay, the Timer0 peripheral can be used. Timer0 is an
8-bit timer/counter that uses a clock source to increment an 8-bit register called TMR0.
Since this register is 8 bits, it can increment up 2
(00000000
TMR0 overflows, a Timer0 Overflow Flag (T0IF) in the OPTION register is set to ‘1’.
This register also features a prescaler that determines how many clock source cycles
it takes to increment TMR0 by ‘1’. In this way, simply by tracking the T0IF, very accurate
delays can be implemented. In this lab, the TMR0 register is configured to increment
on the low-to-high transition of an available internal instruction clock on the PIC16F690.
This internal instruction clock runs at the rate of the internal oscillator frequency F
divided by 4. Therefore, when the PIC16F690 is configured to operate using the inter-
nal 4 MHz oscillator, this internal instruction clock runs at a rate of
F
increments every 1 μS, and it takes 256 internal instruction clock cycles to cause a
TMR0 overflow (i.e., 0-255 inclusive), then Equation 3-1 can be derived:
EQUATION 3-1:
As mentioned, Timer0 also features a prescaler that can be configured to increment the
value in TMR0 every 2, 4, 8, 16, 32, 64, 128, or 256 clock source transitions. Therefore,
this feature can be added to Equation 3-1 to create Equation 3-2.
EQUATION 3-2:
OSC
TMR0 Overflow Period = (4/F
Using a 1:32 prescaler setting as an example and a 4 MHz internal oscillator
TMR0 Overflow Period = 1
- Holds a count value of the number of selected edge transition of a clock
- Selects clock source used to increment TMR0 result register.
- Selects clock source edge transition to increment TMR0.
- Contains a flag that when 1, indicates a TMR0 register overflow has occurred.
source.
Data Sheet).
transitions before incrementing TMR0 register value.
Data Sheet).
/4 = 4MHz/4 = 1MHz. This is a period of 1/1MHz = 1 μS. If it is known that TMR0
TMR0 Overflow Period = (4/F
Lab 3: Simple Delays Using Timer0
NEW REGISTERS USED IN THIS LAB
OVERVIEW
2
- 11111111
General Purpose Input/Output Labs
TMR0 OVERFLOW PERIOD USING FOSC/4
TMR0 OVERFLOW PERIOD WHEN INCLUDING THE
PRESCALER
2
) inclusive then rollover or overflow back to ‘0’. Whenever
μ
S x 256 x 32 = 8.192mS
OSC
) x 256 x prescaler
OSC
) x 256 = 1
μ
8
Second x 256 = 256
= 256 times or 0
10
μ
- 255
Seconds
DS41369A-page 29
10
OSC

Related parts for DM163045