I added some code to the a-d.h file to allow for additional a/d speed settings.
#IFDEF Bit(ADCS2)
SET ADCS2 OFF
#IFDEF HalfSpeed
SET ADCS2 ON
#ENDIF
#ENDIF
This is placed after the conversion clock block in ADRead and ADRead10.
Basically HalfSpeed is a setting for some PICs to divide Fosc in half again in addition to the current speed setting.
Also I had a question about ADFormat and ADFM.
In a-d.h ADFM is not explicitly specified to be off (left justified) in the ADRead function, yet by experimentation it is specified to be OFF. Is it specified by default somewhere, or should this be set to off explicitly (for 10bit adc that take ADResH).
Thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for the extra code, I'll alter a-d.h so that it deals with ADCS2 as well as 1 and 0. None of the datasheets I've looked at before in detail have had more than 2 ADCS bits.
ADFM is set off by the InitSys routine in system.h, plus it is supposed to cleared whenever the PIC is reset. ReadAD10 sets ADFM on, does the requested conversion, and then clears it again.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I added some code to the a-d.h file to allow for additional a/d speed settings.
#IFDEF Bit(ADCS2)
SET ADCS2 OFF
#IFDEF HalfSpeed
SET ADCS2 ON
#ENDIF
#ENDIF
This is placed after the conversion clock block in ADRead and ADRead10.
Basically HalfSpeed is a setting for some PICs to divide Fosc in half again in addition to the current speed setting.
Also I had a question about ADFormat and ADFM.
In a-d.h ADFM is not explicitly specified to be off (left justified) in the ADRead function, yet by experimentation it is specified to be OFF. Is it specified by default somewhere, or should this be set to off explicitly (for 10bit adc that take ADResH).
Thanks
Thanks for the extra code, I'll alter a-d.h so that it deals with ADCS2 as well as 1 and 0. None of the datasheets I've looked at before in detail have had more than 2 ADCS bits.
ADFM is set off by the InitSys routine in system.h, plus it is supposed to cleared whenever the PIC is reset. ReadAD10 sets ADFM on, does the requested conversion, and then clears it again.