DM163045 Microchip Technology, DM163045 Datasheet - Page 51

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.
5. The Do_Outputs() code from the previous lab stays the same.
6. Copy/paste the code in Example 3-21 into the Timing() over the code from the
EXAMPLE 3-21:
7. Copy/paste the code in Example 3-22 over the main() code from the previous
EXAMPLE 3-22:
8. Compile the project, there should be no errors.
3.4.4.4
Program the PIC16F690. Once programmed, the LEDs connected to PORTC should
sequentially light from left-to-right in 10 mS intervals. When the push button is pressed,
the LEDs should change directions and sequentially light from right-to-left.
Continuously pressing the push button will change the direction each time.
It should be noted that the push button press inconsistently changes the direction of
sequential flashing. The problem here is that the firmware performs a technique called
"Polling" to check the state of the RA0 pin that connects to the push button. Therefore,
the state of RA0 is checked only once each time through the software control loop when
the Get_Inputs() is called. This polling is subject to the timing of the software con-
trol loop and will lead to push button presses being missed. If the Timing() remained
at the 1 second delay as implemented in the previous lab, this would have made
matters worse. The next labs will remedy these issues through the use of interrupts.
The solution for this project is located in the
C:\PICDEM_Lab\GPIO_Labs\GPIO_Lab5\solution directory.
Note:
previous lab.
lab.
unsigned int delay_var = 9997;
//Keep looping until the delay_var is
// equal to zero (should take 10mS)
while(--delay_var);
Initialize(); //Initialize the relevant registers
while(1)
{
}
TESTING THE APPLICATION
This lab now utilizes a 10 mS delay to time the software control loop.
Get_Inputs();//Evaluate inputs
Decide();//Make any decisions
Do_Outputs(); //Perform any outputs
Timing();//Sets execution rate of the
General Purpose Input/Output Labs
TIMING() CODE FOR GPIO LAB 5
MAIN() CODE FOR LAB 5
//Software Control Loop
DS41369A-page 47

Related parts for DM163045