Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
h>
#include "lcd.h" //ExploreEmbedded LCD library which contains the lcd
routines
#include "delay.h" //ExploreEmbedded delay library which contains the delay
routines
#include "stdutils.h"
#include "systemInit.h"
int main()
{
uint16_t adc_result=0;
SystemInit(); //Clock and PLL configuration
while(1)
{
AD0CR |= 0x02; /* Select Channel 0 by setting 0th bit of ADCR */
DELAY_us(10); /* allow the channel voltage to stabilize*/
adc_result = (AD0GDR >> SBIT_RESULT) & 0x3ff; /*Read the 10bit adc
result*/