Urgently Need Help In PIC18F458 A/D converter programming

Status
Not open for further replies.

westkid85

New Member
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();
}
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…