@@ -39,23 +39,31 @@ The user has to configure the ADC device (bits, gain) and can call
3939Current implementation will probably change slightly in the future
4040when related devices will be supported. (See future section).
4141
42+ As always feedback is welcome.
43+
44+ ### Special chars
4245
4346Alt-230 = µ
4447
4548
4649### Resolution
4750
48- | Bits | LSB (gain=1) | SPS | Raw range | Notes |
49- | :------:| ---------------:| :------:| :-------------------:| :-------:|
50- | 12 | 1 mV | 240 | -2048 .. 2047 |
51- | 14 | 250 µV | 60 | -8192 .. 8191 |
52- | 16 | 62.5 µV | 15 | -32768 .. 32767 |
53- | 18 | 15.625 µV | 3.75 | -131072 .. 131071 | not for 3426/27/28.
51+ SPS = Samples per second
52+
53+ Interval is the time between consecutive reads in milliseconds.
54+ This is also the time to wait after the switching of a channel.
55+
56+ | Bits | LSB (gain=1) | SPS | Interval | Raw range | Notes |
57+ | :------:| ---------------:| :------:| :----------:| :-------------------:| :-------:|
58+ | 12 | 1 mV | 240 | 4.2 ms | -2048 .. 2047 |
59+ | 14 | 250 µV | 60 | 16.7 ms | -8192 .. 8191 |
60+ | 16 | 62.5 µV | 15 | 66.7 ms | -32768 .. 32767 |
61+ | 18 | 15.625 µV | 3.75 | 266.7 ms | -131072 .. 131071 | not for 3426/27/28.
5462
5563The effective resolution also depends on the gain set.
5664In theory with a gain of 8 the LSB of the 18 bit resolution represents
57651/8 of 15.625 µV == 1.95 µV.
58- If this is feasible in practice is to be seen .
66+ If this is feasible in practice is to be verified .
5967
6068
6169### I2C Address
@@ -140,16 +148,32 @@ The user has to configure the ADC device (bits, gain) and can call
140148Correct settings will be written to the device immediately, but be aware of the fact
141149that it will take some time before the conversion with new settings is done.
142150
151+ #### Channels
152+
143153- ** bool setChannel(uint8_t channel = 0)** not to be used for the MCP3421 as
144154it has only one channel. Default is channel 0, parameter should be less than the
145155value of ** getMaxChannels()** .
156+ After changing a channel one has to wait an interval depending on the resolution used.
157+ See table above.
146158- ** uint8_t getChannel()** returns chosen channel (default 0).
159+
160+ #### Gain
161+
147162- ** bool setGain(uint8_t gain = 1)** set gain to 1,2,4, or 8.
148163Other values will return false and not change the setting.
149164- ** uint8_t getGain()** returns the set gain (default 1).
165+
166+ #### Resolution
167+
150168- ** bool setResolution(uint8_t bits = 12)** set the bit resolution 12,14,16 or 18.
151169Other values will return false and not change the setting.
152170- ** uint8_t getResolution()** returns the set resolution (default 12).
171+ - ** uint16_t getConversionDelay()** returns the delay in ms one has to wait at the
172+ current resolution between calls to ** setChannel()** and /or ** read()** .
173+ See Resolution setcion above.
174+
175+ #### Mode
176+
153177- ** void setContinuousMode()** idem.
154178- ** void setSingleShotMode()** idem.
155179- ** uint8_t getMode()** returns 0 for singleShot and 1 for continuous.
@@ -176,7 +200,8 @@ This might be added in the future.
176200
177201- test on different boards.
178202- optimize performance if possible
179- - check performance I2C with HW
203+ - dividing by ``` _gain ``` ==> multiplication (faster?).
204+ - check performance I2C with HW.
180205- optimize setting all configuration in one function call.
181206 - ** setConfig(channel, resolution, gain, mode)** ?
182207 - getter needed?
0 commit comments