Hi Seb,
On 3-03-13 09:45, Sebastien Lelong wrote:
I'm obviously not a big fan of manual maintenance,
Neither am I, but when there is no choice....
Knowing max value can
be interesting in other contexts, though, if so, I'm wondering why this
question didn't pop up ealier. I'm wondering if it's worth it.
I don't know the anser, maybe it is because high resolution (more than 8
bits) isn't frequently used. To read a simple potmeter 8 bits would be
good enough in many situations. And with a potmeter it is quite easy to
determine maximum resolution by turning it to both sides.
1. enrich devicespecific.json when PICs have 12 bits only resolution
or 10/12bits selectable, or 16bits
2. enrich device file with this information (constant storing #bits +
shortcut to bit in config register to know if running 10 or 12 bits
I'm preparing these two:
a. Devicespecific.json will be extended with a keyword ADCMAXRESOLUTION.
It is optional for PICs without ADRESH and then default to 8 and
optional for PICs with ADRESH and 10-bits resolution. In other cases it
is mandatory (12, or whatever the max resolution is).
b. Every device file will get a constant ADC_MAX_RESOLUTION
which will be 0 (no ADC) 8, 10 or 12 (or whatever the max value).
I must think about the case of configurable maximum resolution whether
to specify the reset default or the real max value (or even both or with
a special mark indication 'configurable').
2. add a adc_get_max_value() in adc.jal. This function:
a. check if ADRESH exists. No means 8bits (we assume you can't even
compile something when PIC has no ADC)
No check for ADRESH needed (see above).
b. If yes, we need to know if it's running with 10 or 12 or 16. If
selectable, check config bits, else just read constant from device file.
For the library we'll have to investigate which PICs have a configurable
maximum resolution. Maybe this could be by a constant in the device file
(e.g. based on the existence of the ADCSEL configuration bit).
And for the library we'll have to find a method to determine the actual
max resolution (at compile-time or at run-time?).
Regards, Rob.
--
R. Hamerling, Netherlands --- http://www.robh.nl
--
You received this message because you are subscribed to the Google Groups
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/jallib?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.