Hello Everyone, Currently i m using PIC18F458 MicroController MPLAB with C18compiler for the A/D Converter Function.
My Task is to display the digital output on several LEDs(any port will do) with the LDR analog input.
Here is the sample coding below, i would like to know what else should i add in the coding below?
--------------------------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <p18cxxx.h>
#pragma config WDT = OFF
#include <adc.h>
#include <delays.h>
int result;
void main (void)
{
OpenADC( ADC_FOSC_RC & ADC_LEFT_JUST & ADC_1ANA_0REF, ADC_CH0 & ADC_INT_OFF);
Delay10TCYx(5);
ConvertADC();
while( BusyADC() );
result = ReadADC();
CloseADC();
}
My Task is to display the digital output on several LEDs(any port will do) with the LDR analog input.
Here is the sample coding below, i would like to know what else should i add in the coding below?
--------------------------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <p18cxxx.h>
#pragma config WDT = OFF
#include <adc.h>
#include <delays.h>
int result;
void main (void)
{
OpenADC( ADC_FOSC_RC & ADC_LEFT_JUST & ADC_1ANA_0REF, ADC_CH0 & ADC_INT_OFF);
Delay10TCYx(5);
ConvertADC();
while( BusyADC() );
result = ReadADC();
CloseADC();
}