ghostman11
Well-Known Member
this is for logans bench supply fan controller project, we have the switching sorted and some of the other bits are coming alone ok but i decided to run it in proteus as a sim and proteus declared AN0 was configured as digital! i thought we had actualy got the ADC sorted but apparently not.
now i have looked in the datasheetbut it hasnt helped much because logan wants to use the inbuilt libs.
that is how he has it set up and he is readiong it with
can anyone see any reason this wont work? the ADC channel we want is ANO the rest digital we are also going to use pwm on cccp1 (if this is poss)
i wont post his full code yet as it needs a good clean up to make sense!!
would we be better setting up ADCON0 - ADCON2 manualy and just use
for the reading and conversion?
now i have looked in the datasheetbut it hasnt helped much because logan wants to use the inbuilt libs.
Code:
OpenADC(ADC_FOSC_8 & ADC_RIGHT_JUST & ADC_0_TAD,
ADC_CH0 & ADC_INT_OFF & ADC_VREFPLUS_VDD & ADC_VREFMINUS_VSS,
0b1011);
Code:
SetChanADC(ADC_CH0);
ConvertADC();
while( BusyADC() ); // Wait for ADC conversion// Wait for ADC conversion
temp1 = ReadADC(); // Read result and put in temp
can anyone see any reason this wont work? the ADC channel we want is ANO the rest digital we are also going to use pwm on cccp1 (if this is poss)
i wont post his full code yet as it needs a good clean up to make sense!!
would we be better setting up ADCON0 - ADCON2 manualy and just use
Code:
SetChanADC(ADC_CH0);
ConvertADC();
while( BusyADC() ); // Wait for ADC conversion// Wait for ADC conversion
temp1 = ReadADC(); // Read result and put in temp