DM163045 Microchip Technology, DM163045 Datasheet - Page 39

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.
The Decide() first checks the current value in LED_Output for two specific condi-
tions:
• Is the Most Significant bit ‘1’? This means that on the next shift, the contents will
• Is the value currently a ‘0’?
If either condition exists, the function re-initializes LED_Output to set the Least Signif-
icant bit. Otherwise, there will be a period when none of the LEDs are lit.
The shift is implemented in code as follows:
LED_Output <<= 1;
This translates to: “LED_Output is equal to the current contents of LED_Output
shifted to the left by 1 bit position”
Conversely, to shift the bit to the right the code would be as follows:
LED_Output >>= 1;
The Do_Outputs() will then assign the contents of the LED_Output variable to the
PORTC register and whichever bit is high will light the connected LED. (See
Figure 3-17.)
FIGURE 3-17:
The Initialize() now configures the PIC16F690 peripherals as follows:
• PORTC
• Timer0
• Initialize the LED_Output variable to ‘0’
Next time through main():
First time through main():
LED_Output variable
LED_Output variable
be all ‘0’s.
- Initialize PORTC so that the 7 Most Significant bits are ‘0’ and the Least
- Make all PORTC pins digital output
- Use the internal instruction clock (F
- Increment TMR0 register on low-to-high transition of F
- Assign the prescaler to Timer0 and configure to increment on every 256th
0
0
Initialize() determines initial
Significant bit is ‘1’
transition of F
LED_Output Left by 1 bit position
0
Decide() shifts contents of
0
contents of LED_Output
0
0
0
0
General Purpose Input/Output Labs
OSC
0
0
RESULTS OF DO_OUTPUT()
/4
0
0
0
1
1
0
LED_Output to
Do_Outputs()
LED_Output to
Do_Outputs()
PORTC
assigns
assigns
PORTC
OSC
/4) as the TMR0 register clock source
PORTC
0
PORTC
0
0
0
0
Corresponding LED lights
0
Corresponding LED lights
OSC
0
0
/4
0
0
0
0
DS41369A-page 35
0
1
1
0

Related parts for DM163045