DM163045 Microchip Technology, DM163045 Datasheet - Page 31

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 Do_Outputs() changes somewhat from the previous lab by implementing the
XOR operator to toggle the value in each PORTC bit location each time through the
software loop. The XOR operator is implemented in code as follows:
RCx ^= 1;
This translates to: “Make RCx equal to the current value in RCx XOR’d with 1”
When a value is XOR’d with itself, the result is ‘0’ (i.e., 1 XOR’d with 1 = 0, 0 XOR’d
with 0 = 0). When a value is XOR’d with a value different than itself, the result is ‘1’ (i.e.,
1 XOR’d with 0 = 1). Therefore, each time through the loop PORTC bits will toggle from
1-to-0 or 0-to-1 depending on its current value.
3.3.5.2
Using the code developed in the previous lab, make the following changes:
1. Copy/paste the code in Example 3-4 over the Initialize() code from the
EXAMPLE 3-4:
The only change from the previous lab is that the PORTC bits are all set high to 1.
2. Copy/paste the code in Example 3-5 over the Do_Outputs() code from the
Note:
previous lab.
previous lab to accommodate the XOR bit toggle.
//Set all PORTC bits HIGH (to a known state)
PORTC = 0b11111111;
//Configure PORTC's ANALOG/DIGITAL pins as all Digital
ANS4 = 0;//Associated with RC0
ANS5 = 0;//Associated with RC1
ANS6 = 0;//Associated with RC2
ANS7 = 0;//Associated with RC3
ANS8 = 0;//Associated with RC6
ANS9 = 0;//Associated with RC7
//Configure PORTC pins as all output
//i.e. 1 = Input, 0 = Output
TRISC0 = 0;//Make RC0 (pin 16) output
TRISC1 = 0;//Make RC1 (pin 15) output
TRISC2 = 0;//Make RC2 (pin 14) output
TRISC3 = 0;//Make RC3 (pin 7) output
TRISC4 = 0;//Make RC4 (pin 6) output
TRISC5 = 0;//Make RC5 (pin 5) output
TRISC6 = 0;//Make RC6 (pin 8) output
TRISC7 = 0;//Make RC7 (pin 9) output
PROCEDURE
The reader may wish to create a new project as per the previous lab called
GPIO_Lab2.mcp
General Purpose Input/Output Labs
INITIALIZE() CODE FOR LAB 2
DS41369A-page 27

Related parts for DM163045