#48 PIC16 libio adc config problem

closed-accepted
None
5
2006-06-11
2005-11-23
Nick Materer
No

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
57c57
< 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
47,48c47,49
< #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
50,51c51,52
< #define ADC_FOSC_64 0x12
< #define ADC_FOSC_RC 0x03
---
> #define ADC_FOSC_64 0x06
> #define ADC_FOSC_RC 0x07

Discussion

  • Vangelis Rokas
    Vangelis Rokas
    2006-06-11

    Logged In: YES
    user_id=770505

    Patch applied in SDCC 2.5.4 #4218

     
  • Vangelis Rokas
    Vangelis Rokas
    2006-06-11

    • assigned_to: nobody --> vrokas
    • status: open --> closed-accepted