Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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.

Latest threads

EE World Online Articles

Loading
Top