I using a PIC18F452 and playing the adc routines in
libio in the sdcc-src-20051118 release.
I found two small problems.
1) adcopen.c has the wrong reg on line 57
diff adcopen.c.org pic16/lib/libio/adc/adcopen.c
< ADCON0 |= (config & ADC_FRM_RJUST);
> ADCON1 |= (config & ADC_FRM_RJUST);
2) the header file does not list all the OSC prescalers
and some of the def's are not correcct wrong.
Alternativly one could change the shift on line
52 in adcopen.c
diff adc.h.org pic16/include/adc.h
< #define ADC_FOSC_4 0x10
< #define ADC_FOSC_16 0x11
> #define ADC_FOSC_4 0x04
> #define ADC_FOSC_8 0x01
> #define ADC_FOSC_16 0x05
< #define ADC_FOSC_64 0x12
< #define ADC_FOSC_RC 0x03
> #define ADC_FOSC_64 0x06
> #define ADC_FOSC_RC 0x07
Log in to post a comment.