I have programmed the code onto the PIC and tested it by varying the input voltage on AN0 from 0-5V and just get a "not square" square wave, and the duty cycle doesn't change at all, just the voltage level of the output signal.
In MPLAB, my code builds successfully but when i go to MPLAB SIM in the output box i get the message:
"ADC-W0010: A Minimum of 2 TADs are required before another conversion should be started.
Does this mean i need to add a delay somewhere in my program?
I have been reading this thread:
https://www.electro-tech-online.com/threads/pic18f452-adc.23175/
In which forum members describe the need for delays in the program, where should these delays be placed?
From my understanding of the datasheet, TAD is controlled by the ADCON0 register? I have to use the 32Tosc operation as my external oscillator crystal is at 8MHz, this corresponds to ADCS1:ADCS0 being 10, is this correct?
Help on this would be great,
Thanks