DM163045 Microchip Technology, DM163045 Datasheet - Page 83

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.
FIGURE 5-3:
Following the Get_Inputs(), the 10-bit ADC result is now in the ADRESH:ADRESL
registers. The Decide() assigns the ADC result value, shifted four bit positions to the
right, to the LED_Output variable.
Finally, the Do_Outputs() assigns the contents of LED_Output to the PORTC
register that will light the LEDs connected to RC0, RC1, RC2 and RC3 accordingly.
5.2.3.3
Using the Project Wizard, create a new project called ADC_Lab1.mcp. Once com-
pleted, open the ADC_Lab1.c source file in MPLAB and make the following changes:
1. Copy/paste the code in Example 5-1 into the top of the main firmware source file
EXAMPLE 5-1:
2. Copy/paste the code in Example 5-2 into the top of the main firmware source file
Analog-to-Digital Converter Peripheral Labs
unsigned char LED_Output = 0;//assigned to PORTC to light
under the heading labeled:
//----------------DATA MEMORY---------------
under the heading labeled:
//----------------SUPPORT ROUTINES---------------
Gives ADC capacitor time to charge
PROCEDURE
Wait for ADC to complete
MAIN() SOFTWARE CONTROL LOOP FLOWCHART FOR
COMPARATOR LAB 1
GLOBAL VARIABLES USED IN LAB 1
Start conversion by setting
//connected LEDs
Get_Inputs()
Delay_1mS()
GO/DONE = 1
GO/DONE bit
END
?
NO
YES
DS41369A-page 79

Related parts for DM163045