DM163045 Microchip Technology, DM163045 Datasheet - Page 49

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
General Purpose Input/Output Labs
EXAMPLE 3-18:
INITIALIZE() FOR GPIO LAB 5
//Clear PORTC to a known state
//Set the least significant bit to 1 so that it can be
//shifted through
PORTC = 0b00000001;
//Clear the PORTA register to a known state
PORTA = 0b00000000;
//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;//Associated with RC0
TRISC1 = 0;//Associated with RC1
TRISC2 = 0;//Associated with RC2
TRISC3 = 0;//Associated with RC3
TRISC4 = 0;//Associated with RC4
TRISC5 = 0;//Associated with RC5
TRISC6 = 0;//Associated with RC6
TRISC7 = 0;//Associated with RC7
//Configure PORTA bit RA0 as Digital input
ANS2 = 0;
TRISA2 = 1;
//Configure Timer0 to overflow every 5mS
T0CS = 0; //Select FOSC/4 as Timer0 clock source
T0SE = 0; //Increment TMR0 on rising clock edge
PSA = 0; //Assign prescaler to Timer0
//Select a 1:32 prescaler
PS0 = 0;
PS1 = 0;
PS2 = 1;
//Initialize the direction flag to shift bits from
//right-to-left
//(i.e. 0 = Shift PORTC bits from right-to-left
//
1 = Shift PORTC bits from left-to-right
direction = 0;
//Initialize LED_Output to all zeros
LED_Output = 0b00000000;
© 2009 Microchip Technology Inc.
DS41369A-page 45

Related parts for DM163045