Hi Rob,
adc_hardware was one of the first lib integrated to jallib. I did it, and I
modify as less as possible. This library would really need a "cleaning",
since there are many inconsistencies, hard-coded stuff, etc... as you
mentioned. We probably should provide our own library ("adc.jal", since adc
can only hardware), and still provide adc_hardware for backward compatbility
(with a warning).
Yes, I'm sure we can do better, now we have control over all device files.
But this is quite a big amount of work, and I preferred quick fixing the lib
and provide a new feature, instead of re-writing the lib. But I can be
wrong, and we can discuss this if needed.
As for 18F, I don't think this would break the fix, since the fix's logic
is: "if you want high resolution ADC, you need to have ADRESH" and "if
ADRESH is found, it is preferred instead of ADRES". But I don't know if this
adc_hardware lib is actually working with 18F at all !...
Cheers,
Seb
2009/1/9 Rob Hamerling <[email protected]>
>
>
> Hi Seb,
>
> Sebastien Lelong wrote:
> >
> > I've made a quick fix in order to close issue 31 (
>
> I've used ADC only for a few dimmers, and not with JAL, so I'm not an
> expert on this. But out of curiosity I browsed the adc library and saw
> some questionable thinks:
>
> Is it really necessary to shadow ADCON0? I thought this was only needed
> for registers which have an external connection (to prevent the RMW
> problem). I don't think ADCON0 suffers of this problem and it
> complicates the code (unnecessarily?).
>
> I saw that the 12F675 is handled differently than all others. This could
> be a relic from the time that library makers decided for us which PICs
> are good for us. I don't believe this PIC is so unique as far as ADC
> control is concerned, there are probably other PICs which have to be
> handled similarly.
>
> The lib contains several statements like:
> > ADCON1 = ADCON1 | 0x80
> With JalV2 this can better be written as:
> ADCON1_ADFM = TRUE
> for more device independency.
>
> I think the 12F675 (and other) specific handling as mentioned above can
> also be overcome by using register subfields (bit groups) in stead of
> 'and' and 'or' operations on a whole register.
>
> The 18Fs have an ADRES (word) register and ADRESL and ADRESH (byte)
> registers. I don't know if this would frustrate the quick fix, but it
> might be worth checking.
>
> Regards, Rob.
>
>
> --
> Rob Hamerling, Vianen, NL (http://www.robh.nl/)
>
> >
>
--
Sébastien Lelong
http://www.sirloon.net
http://sirbot.org
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jallib" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jallib?hl=en
-~----------~----~----~----~------~----~------~--~---