bhan1992
Member level 1
- Joined
- Feb 25, 2012
- Messages
- 34
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,286
- Activity points
- 1,511
Code:
#include <p18f43k22.h>
#include <adc.h>
#include <stdlib.h>
#include <delays.h>
int result, increment;
void main (void)
{
OpenADC(ADC_FOSC_32 & ADC_RIGHT_JUST & ADC_2_TAD, ADC_REF_VDD_VSS, ADC_CH0 & ADC_INT_OFF );
TRISB = 0;
while(1)
{
SetChanADC(ADC_CH0);
ConvertADC();
while(BusyADC());
result = ReadADC();
if (result < 550)
{
PORTB = 1;
}
else
{
PORTB = 0;
}
}
CloseADC();
}
does the code has something missing?