| Linduino 1.3.0 Linear Technology Arduino-Compatible Demonstration Board

LTC24XX_general.h
Go to the documentation of this file.
1 /*!
2 LTC24XX General Library: Functions and defines for all SINC4 Delta Sigma ADCs.
3
4 @verbatim
5
6
7 LTC2442 / LTC2444 / LTC2445 / LTC2448 / LTC2449 (Are there don't care bits in the low channel counts?
8 SPI DATA FORMAT (MSB First):
9
10 Byte #1 Byte #2
11
12 Data Out : !EOC DMY SIG D28 D27 D26 D25 D24 D23 D22 D21 D20 D19 D18 D17 D16
13 Data In : 1 0 EN SGL OS S2 S1 S0 OSR3 OSR2 OSR1 OSR1 SPD X X X
14
15 Byte #3 Byte #4
16 D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 *D3 *D2 *D1 *D0
17 X X X X X X X X X X X X X X X X
18
19 !EOC : End of Conversion Bit (Active Low)
20 DMY : Dummy Bit (Always 0)
21 SIG : Sign Bit (1-data positive, 0-data negative)
22 Dx : Data Bits
23 *Dx : Data Bits Below lsb
24 EN : Enable Bit (0-keep previous mode, 1-change mode)
25 SGL : Enable Single-Ended Bit (0-differential, 1-single-ended)
26 OS : ODD/Sign Bit
27 Sx : Address Select Bit
28 0SRX : Over Sampling Rate Bits
29 SPD : Double Output Rate Select Bit (0-Normal rate, auto-calibration on, 2x rate, auto_calibration off)
30
31 Command Byte #1
32 1 0 EN SGL OS S2 S1 S0 Comments
33 1 0 0 X X X X X Keep Previous Mode
34 1 0 1 0 X X X X Differential Mode
35 1 0 1 1 X X X X Single-Ended Mode
36
37 | Coversion Rate | RMS | ENOB | OSR | Latency
38 Command Byte #2 |Internal | External | Noise | | |
39 | 9MHz | 10.24MHz | | | |
40 OSR3 OSR2 OSR1 OSR1 SPD | Clock | Clock | | | |
41 0 0 0 0 0 Keep Previous Speed/Resolution
42 0 0 0 1 0 3.52kHz 4kHz 23uV 17 64 none
43 0 0 1 0 0 1.76kHz 2kHz 3.5uV 20.1 128 none
44 0 0 1 1 0 880Hz 1kHz 2uV 21.3 256 none
45 0 1 0 0 0 440Hz 500Hz 1.4uV 21.8 512 none
46 0 1 0 1 0 220Hz 250Hz 1uV 22.4 1024 none
47 0 1 1 0 0 110Hz 125Hz 750nV 22.9 2048 none
48 0 1 1 1 0 55Hz 62.5Hz 510nV 23.4 4096 none
49 1 0 0 0 0 27.5Hz 31.25Hz 375nV 24 8192 none
50 1 0 0 1 0 13.75Hz 15.625Hz 250nV 24.4 16384 none
51 1 1 1 1 0 6.87kHz 7.8125Hz 200nV 24.6 32768 none
52 0 0 0 0 1 Keep Previous Speed/Resolution
53 OSR3 OSR2 OSR1 OSR1 1 2X Mode *all clock speeds double
54
55 Example Code:
56
57 Read Channel 0 in Single-Ended with OSR of 65536
58
59 uint16_t miso_timeout = 1000;
60 adc_command = LTC2449_CH0 | LTC2449_OSR_32768 | LTC2449_SPEED_2X; // Build ADC command for channel 0
61 // OSR = 32768*2 = 65536
62
63 if(LTC2449_EOC_timeout(LTC2449_CS, miso_timeout)) // Check for EOC
64 return; // Exit if timeout is reached
65 LTC2449_read(LTC2449_CS, adc_command, &adc_code); // Throws out last reading
66
67 if(LTC2449_EOC_timeout(LTC2449_CS, miso_timeout)) // Check for EOC
68 return; // Exit if timeout is reached
69 LTC2449_read(LTC2449_CS, adc_command, &adc_code); // Obtains the current reading and stores to adc_code variable
70
71 // Convert adc_code to voltage
72 adc_voltage = LTC2449_code_to_voltage(adc_code, LTC2449_lsb, LTC2449_offset_code);
73
74 @endverbatim
75
76 http://www.linear.com/product/LTC2449
77
78 http://www.linear.com/product/LTC2449#demoboards
79
80
81 Copyright 2018(c) Analog Devices, Inc.
82
83 All rights reserved.
84
85 Redistribution and use in source and binary forms, with or without
86 modification, are permitted provided that the following conditions are met:
87 - Redistributions of source code must retain the above copyright
88 notice, this list of conditions and the following disclaimer.
89 - Redistributions in binary form must reproduce the above copyright
90 notice, this list of conditions and the following disclaimer in
91 the documentation and/or other materials provided with the
92 distribution.
93 - Neither the name of Analog Devices, Inc. nor the names of its
94 contributors may be used to endorse or promote products derived
95 from this software without specific prior written permission.
96 - The use of this software may or may not infringe the patent rights
97 of one or more patent holders. This license does not release you
98 from the requirement that you obtain separate licenses from these
99 patent holders to use this software.
100 - Use of the software either in source or binary form, must be run
101 on or directly connected to an Analog Devices Inc. component.
102
103 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
104 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
105 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
106 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
107 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
108 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
109 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
110 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
111 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
112 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
113 */
114
115 /*! @file
116 @ingroup LTC24XX_general
117 Header for LTC2449: 24-Bit, 16-Channel Delta Sigma ADCs with Selectable Speed/Resolution
118 */
119
120 #ifndef LTC24XX_general_H
121 #define LTC24XX_general_H
122
123 //! Define the SPI CS pin
124 #ifndef LTC24XX_CS
125 #define LTC24XX_CS QUIKEVAL_CS
126 #endif
127
128 //! In 2X Mode, A non offset binary 0 can be produced. This is corrected in the
129 //! differential code to voltage functions. To disable this correction, uncomment
130 //! The following #define.
131 //#define SKIP_EZDRIVE_2X_ZERO_CHECK
132
133 /*! @name Mode Configuration for High Speed Family
134 @{
135 */
136 #define LTC24XX_HS_MULTI_KEEP_PREVIOUS_MODE 0x80
137 #define LTC24XX_HS_MULTI_KEEP_PREVIOUS_SPEED_RESOLUTION 0x00
138 #define LTC24XX_HS_MULTI_SPEED_1X 0x00
139 #define LTC24XX_HS_MULTI_SPEED_2X 0x08
140 /*!
141 @}
142 */
143
144 /*! @name Mode Configuration for EasyDrive Family
145 @{
146 */
147 // Select ADC source - differential input or PTAT circuit
148 #define LTC24XX_EZ_MULTI_VIN 0b10000000
149 #define LTC24XX_EZ_MULTI_PTAT 0b11000000
150
151 // Select rejection frequency - 50, 55, or 60Hz
152 #define LTC24XX_EZ_MULTI_R50 0b10010000
153 #define LTC24XX_EZ_MULTI_R55 0b10000000
154 #define LTC24XX_EZ_MULTI_R60 0b10100000
155
156 // Speed settings is bit 7 in the 2nd byte
157 #define LTC24XX_EZ_MULTI_SLOW 0b10000000 // slow output rate with autozero
158 #define LTC24XX_EZ_MULTI_FAST 0b10001000 // fast output rate with no autozero
159 /*!
160 @}
161 */
162
163
164 /*! @name Single-Ended Channel Configuration
165 @verbatim
166 Channel selection for all multi-channel, differential input ADCs, even those that only require
167 8 bits of configuration (no further options.) Most devices in this category require a second
168 byte of configuration for speed mode, temperature sensor selection, etc., but for the sake
169 of simplicity a single function will be used to read all devices, sending zeros in the second
170 configuration byte if only the channel is specified.
171
172 Applicable devices:
173 Easy Drive:
174 LTC2486, LTC2487, LTC2488, LTC2489, LTC2492, LTC2493,
175 LTC2494, LTC2495, LTC2496, LTC2497, LTC2498, LTC2499
176 First Generation Differential:
177 LTC2414, LTC2418, LTC2439
178 High Speed:
179 LTC2442, LTC2444, LTC2445, LTC2448, LTC2449
180 @endverbatim
181 @{ */
182 #define LTC24XX_MULTI_CH_CH0 0xB0
183 #define LTC24XX_MULTI_CH_CH1 0xB8
184 #define LTC24XX_MULTI_CH_CH2 0xB1
185 #define LTC24XX_MULTI_CH_CH3 0xB9
186 #define LTC24XX_MULTI_CH_CH4 0xB2
187 #define LTC24XX_MULTI_CH_CH5 0xBA
188 #define LTC24XX_MULTI_CH_CH6 0xB3
189 #define LTC24XX_MULTI_CH_CH7 0xBB
190 #define LTC24XX_MULTI_CH_CH8 0xB4
191 #define LTC24XX_MULTI_CH_CH9 0xBC
192 #define LTC24XX_MULTI_CH_CH10 0xB5
193 #define LTC24XX_MULTI_CH_CH11 0xBD
194 #define LTC24XX_MULTI_CH_CH12 0xB6
195 #define LTC24XX_MULTI_CH_CH13 0xBE
196 #define LTC24XX_MULTI_CH_CH14 0xB7
197 #define LTC24XX_MULTI_CH_CH15 0xBF
198 /*! @} */
199
200 /*! @name Differential Channel Configuration
201 @verbatim
202 See note for single-ended configuration above.
203
204 @endverbatim
205 @{ */
206 #define LTC24XX_MULTI_CH_P0_N1 0xA0
207 #define LTC24XX_MULTI_CH_P1_N0 0xA8
208
209 #define LTC24XX_MULTI_CH_P2_N3 0xA1
210 #define LTC24XX_MULTI_CH_P3_N2 0xA9
211
212 #define LTC24XX_MULTI_CH_P4_N5 0xA2
213 #define LTC24XX_MULTI_CH_P5_N4 0xAA
214
215 #define LTC24XX_MULTI_CH_P6_N7 0xA3
216 #define LTC24XX_MULTI_CH_P7_N6 0xAB
217
218 #define LTC24XX_MULTI_CH_P8_N9 0xA4
219 #define LTC24XX_MULTI_CH_P9_N8 0xAC
220
221 #define LTC24XX_MULTI_CH_P10_N11 0xA5
222 #define LTC24XX_MULTI_CH_P11_N10 0xAD
223
224 #define LTC24XX_MULTI_CH_P12_N13 0xA6
225 #define LTC24XX_MULTI_CH_P13_N12 0xAE
226
227 #define LTC24XX_MULTI_CH_P14_N15 0xA7
228 #define LTC24XX_MULTI_CH_P15_N14 0xAF
229 /*! @} */
230
231 /*Commands
232 Construct a channel / resolution control word by bitwise ORing one choice from the channel configuration
233 and one choice from the Oversample ratio configuration. You can also enable 2Xmode, which will increase
234 sample rate by a factor of 2 but introduce one cycle of latency.
235
236 Example - read channel 3 single-ended at OSR2048, with 2X mode enabled.
237 adc_command = (LTC2449_CH3 | LTC2449_OSR_2048) | LTC2449_SPEED_2X;
238 */
239
240 /*! @name Oversample Ratio (OSR) Commands
241 @{ */
242 #define LTC24XX_MULTI_CH_OSR_64 0x10
243 #define LTC24XX_MULTI_CH_OSR_128 0x20
244 #define LTC24XX_MULTI_CH_OSR_256 0x30
245 #define LTC24XX_MULTI_CH_OSR_512 0x40
246 #define LTC24XX_MULTI_CH_OSR_1024 0x50
247 #define LTC24XX_MULTI_CH_OSR_2048 0x60
248 #define LTC24XX_MULTI_CH_OSR_4096 0x70
249 #define LTC24XX_MULTI_CH_OSR_8192 0x80
250 #define LTC24XX_MULTI_CH_OSR_16384 0x90
251 #define LTC24XX_MULTI_CH_OSR_32768 0xF0
252 /*! @}*/
253
254 //! Checks for EOC with a specified timeout. Applies to all SPI interface delta sigma
255 //! ADCs that have SINC4 rejection, does NOT apply to LTC2450/60/70 family.
256 //! @return Returns 0=successful, 1=unsuccessful (exceeded timeout)
257 int8_t LTC24XX_EOC_timeout(uint8_t cs, //!< Chip Select pin
258 uint16_t miso_timeout //!< Timeout (in milliseconds)
259 );
260
261
262 // Read functions for SPI interface ADCs with a 32 bit output word. These functions are used with both
263 // Single-ended and differential parts, as there is no interpretation of the data done in
264 // the function. Also note that these functions can be used for devices that have shorter output lengths,
265 // the lower bits will read out as "1", as the conversion will be triggered by the last data bit being
266 // read, which causes SDO to go high.
267
268
269 //! Reads from LTC24XX ADC that has no configuration word and returns a 32 bit result.
270 //! @return void
271 void LTC24XX_SPI_32bit_data(uint8_t cs, //!< Chip Select pin
272 int32_t *adc_code //!< 4 byte conversion code read from LTC24XX
273 );
274
275 //! Reads from LTC24XX ADC that accepts an 8 bit configuration and returns a 32 bit result.
276 //! @return void
277 void LTC24XX_SPI_8bit_command_32bit_data(uint8_t cs, //!< Chip Select pin
278 uint8_t adc_command, //!< 1 byte command written to LTC24XX
279 int32_t *adc_code //!< 4 byte conversion code read from LTC24XX
280 );
281
282 //! Reads from LTC24XX ADC that accepts a 16 bit configuration and returns a 32 bit result.
283 //! @return void
284 void LTC24XX_SPI_16bit_command_32bit_data(uint8_t cs, //!< Chip Select pin
285 uint8_t adc_command_high, //!< First command byte written to LTC24XX
286 uint8_t adc_command_low, //!< Second command written to LTC24XX
287 int32_t *adc_code //!< 4 byte conversion code read from LTC24XX
288 );
289
290 //! Reads from LTC24XX two channel "Ping-Pong" ADC, placing the channel information in the adc_channel parameter
291 //! and returning the 32 bit result with the channel bit cleared so the data format matches the rest of the family
292 //! @return void
293 void LTC24XX_SPI_2ch_ping_pong_32bit_data(uint8_t cs, //!< Chip Select pin
294 uint8_t *adc_channel, //!< Returns channel number read.
295 int32_t *code //!< 4 byte conversion code read from LTC24XX
296 );
297
298
299 // Read functions for SPI interface ADCs with a 24 bit or 19 bit output word. These functions
300 // are used with both Single-ended and differential parts, as there is no interpretation of
301 // the data done in the function. 24 bits will be read out of 19 bit devices
302 // (LTC2433, LTC2436, LTC2439), with the additional 5 bits being set to 1.
303
304 //! Reads from LTC24XX ADC that has no configuration word and returns a 32 bit result.
305 //! @return void
306 void LTC24XX_SPI_24bit_data(uint8_t cs, //!< Chip Select pin
307 int32_t *adc_code //!< 4 byte conversion code read from LTC24XX
308 );
309
310 //! Reads from LTC24XX ADC that accepts an 8 bit configuration and returns a 32 bit result.
311 //! @return void
312 void LTC24XX_SPI_8bit_command_24bit_data(uint8_t cs, //!< Chip Select pin
313 uint8_t adc_command, //!< 1 byte command written to LTC24XX
314 int32_t *adc_code //!< 4 byte conversion code read from LTC24XX
315 );
316
317 //! Reads from LTC24XX ADC that accepts a 16 bit configuration and returns a 32 bit result.
318 //! @return void
319 void LTC24XX_SPI_16bit_command_24bit_data(uint8_t cs, //!< Chip Select pin
320 uint8_t adc_command_high, //!< First command byte written to LTC24XX
321 uint8_t adc_command_low, //!< Second command written to LTC24XX
322 int32_t *adc_code //!< 4 byte conversion code read from LTC24XX
323 );
324
325 //! Reads from LTC24XX ADC that accepts a 8 bit configuration and returns a 16 bit result.
326 //! @return void
327 void LTC24XX_SPI_8bit_command_16bit_data(uint8_t cs, //!< Chip Select pin
328 uint8_t adc_command, //!< First command byte written to LTC24XX
329 int32_t *adc_code //!< 4 byte conversion code read from LTC24XX
330 );
331
332
333 //! Reads from LTC24XX two channel "Ping-Pong" ADC, placing the channel information in the adc_channel parameter
334 //! and returning the 32 bit result with the channel bit cleared so the data format matches the rest of the family
335 //! @return void
336 void LTC24XX_SPI_2ch_ping_pong_24bit_data(uint8_t cs, //!< Chip Select pin
337 uint8_t *adc_channel, //!< Returns channel number read.
338 int32_t *code //!< 4 byte conversion code read from LTC24XX
339 );
340
341 // Read functions for I2C interface ADCs with a 32 bit output word. These functions are used with both
342 // Single-ended and differential parts, as there is no interpretation of the data done in
343 // the function. Also note that these functions can be used for devices that have shorter output lengths,
344 // the lower bits will read out as "1", as the conversion will be triggered by the last data bit being
345 // read, which causes SDO to go high.
346 // Data is formatted to match the SPI devices, with the MSB in the bit 28 position.
347 // Unlike the SPI members of this family, checking for EOC MUST immediately be followed by reading the data. This
348 // is because a stop condition will trigger a new conversion.
349
350
351 //! Reads from LTC24XX ADC that has no configuration word and returns a 32 bit result.
352 //! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
353 int8_t LTC24XX_I2C_32bit_data(uint8_t i2c_address, //!< I2C address of device
354 int32_t *adc_code, //!< 4 byte conversion code read from LTC24XX
355 uint16_t eoc_timeout //!< Timeout (in milliseconds)
356 );
357
358
359 //! Reads from LTC24XX ADC that accepts an 8 bit configuration and returns a 32 bit result.
360 //! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
361 int8_t LTC24XX_I2C_8bit_command_32bit_data(uint8_t i2c_address, //!< I2C address of device
362 uint8_t adc_command, //!< 1 byte command written to LTC24XX
363 int32_t *adc_code, //!< 4 byte conversion code read from LTC24XX
364 uint16_t eoc_timeout //!< Timeout (in milliseconds)
365 );
366
367
368 //! Reads from LTC24XX ADC that accepts a 16 bit configuration and returns a 32 bit result.
369 //! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
370 int8_t LTC24XX_I2C_16bit_command_32bit_data(uint8_t i2c_address, //!< I2C address of device
371 uint8_t adc_command_high, //!< First command byte written to LTC24XX
372 uint8_t adc_command_low, //!< Second command written to LTC24XX
373 int32_t *adc_code, //!< 4 byte conversion code read from LTC24XX
374 uint16_t eoc_timeout //!< Timeout (in milliseconds)
375 );
376
377
378 // Read functions for I2C interface ADCs with a 24 bit or 19 bit output word. These functions
379 // are used with both Single-ended and differential parts, as there is no interpretation of
380 // the data done in the function. 24 bits will be read out of 19 bit devices
381 // (LTC2433, LTC2436, LTC2439), with the additional 5 bits being set to 1.
382
383
384 //! Reads from LTC24XX ADC that has no configuration word and returns a 32 bit result.
385 //! Applies to: LTC2483 (only this lonely one!)
386 //! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
387 int8_t LTC24XX_I2C_24bit_data(uint8_t i2c_address, //!< I2C address of device
388 int32_t *adc_code, //!< 4 byte conversion code read from LTC24XX
389 uint16_t eoc_timeout //!< Timeout (in milliseconds)
390 );
391
392
393 //! Reads from LTC24XX ADC that accepts an 8 bit configuration and returns a 32 bit result.
394 //! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
395 int8_t LTC24XX_I2C_8bit_command_24bit_data(uint8_t i2c_address, //!< I2C address of device
396 uint8_t adc_command, //!< 1 byte command written to LTC24XX
397 int32_t *adc_code, //!< 4 byte conversion code read from LTC24XX
398 uint16_t eoc_timeout //!< Timeout (in milliseconds)
399 );
400
401 //! Reads from LTC24XX ADC that accepts a 16 bit configuration and returns a 32 bit result.
402 //! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
403 int8_t LTC24XX_I2C_16bit_command_24bit_data(uint8_t i2c_address, //!< I2C address of device
404 uint8_t adc_command_high, //!< First command byte written to LTC24XX
405 uint8_t adc_command_low, //!< Second command written to LTC24XX
406 int32_t *adc_code, //!< 4 byte conversion code read from LTC24XX
407 uint16_t eoc_timeout //!< Timeout (in milliseconds)
408 );
409
410 //! Calculates the voltage corresponding to an ADC code, given the reference voltage.
411 //! Applies to Single-Ended input parts (LTC2400-type input)
412 //! @return Returns voltage calculated from ADC code.
413 float LTC24XX_SE_code_to_voltage(int32_t adc_code, //!< Code read from ADC
414 float vref //!< Reference voltage
415 );
416 //! Calculates the voltage corresponding to an ADC code, given the reference voltage.
417 //! Applies to differential input parts (LTC2410 type input)
418 //! @return Returns voltage calculated from ADC code.
419 float LTC24XX_diff_code_to_voltage(int32_t adc_code, //!< Code read from ADC
420 float vref //!< Reference voltage
421 );
422
423 //! Calculates the voltage corresponding to an ADC code, given lsb weight (in volts) and the calibrated
424 //! ADC offset code (zero code that is subtracted from adc_code).
425 //! Applies to differential input, SPI interface parts.
426 //! @return Returns voltage calculated from ADC code.
427 float LTC24XX_diff_code_to_calibrated_voltage(int32_t adc_code, //!< Code read from ADC
428 float LTC24XX_lsb, //!< LSB weight (in volts)
429 int32_t LTC24XX_offset_code //!< The calibrated offset code (This is the ADC code zero code that will be subtracted from adc_code)
430 );
431
432 //! Calculate the lsb weight and offset code given a full-scale code and a measured zero-code.
433 //! @return Void
434 void LTC24XX_calibrate_voltage(int32_t zero_code, //!< Measured code with the inputs shorted to ground
435 int32_t fs_code, //!< Measured code at nearly full-scale
436 float zero_voltage, //!< Measured zero voltage
437 float fs_voltage, //!< Voltage measured at input (with voltmeter) when fs_code was read from ADC
438 float *LTC24XX_lsb, //!< Overwritten with lsb weight (in volts)
439 int32_t *LTC24XX_offset_code //!< Overwritten with offset code (zero code)
440 );
441
442
443
444 // I2C Addresses for 8/16 channel parts (LTC2495/7/9)
445 // ADDRESS CA2 CA1 CA0
446 // #define LTC24XX_16CH_I2C_ADDRESS 0b0010100 // LOW LOW LOW
447 // #define LTC24XX_16CH_I2C_ADDRESS 0b0010110 // LOW LOW HIGH
448 // #define LTC24XX_16CH_I2C_ADDRESS 0b0010101 // LOW LOW FLOAT
449 // #define LTC24XX_16CH_I2C_ADDRESS 0b0100110 // LOW HIGH LOW
450 // #define LTC24XX_16CH_I2C_ADDRESS 0b0110100 // LOW HIGH HIGH
451 // #define LTC24XX_16CH_I2C_ADDRESS 0b0100111 // LOW HIGH FLOAT
452 // #define LTC24XX_16CH_I2C_ADDRESS 0b0010111 // LOW FLOAT LOW
453 // #define LTC24XX_16CH_I2C_ADDRESS 0b0100101 // LOW FLOAT HIGH
454 // #define LTC24XX_16CH_I2C_ADDRESS 0b0100100 // LOW FLOAT FLOAT
455 // #define LTC24XX_16CH_I2C_ADDRESS 0b1010110 // HIGH LOW LOW
456 // #define LTC24XX_16CH_I2C_ADDRESS 0b1100100 // HIGH LOW HIGH
457 // #define LTC24XX_16CH_I2C_ADDRESS 0b1010111 // HIGH LOW FLOAT
458 // #define LTC24XX_16CH_I2C_ADDRESS 0b1110100 // HIGH HIGH LOW
459 // #define LTC24XX_16CH_I2C_ADDRESS 0b1110110 // HIGH HIGH HIGH
460 // #define LTC24XX_16CH_I2C_ADDRESS 0b1110101 // HIGH HIGH FLOAT
461 // #define LTC24XX_16CH_I2C_ADDRESS 0b1100101 // HIGH FLOAT LOW
462 // #define LTC24XX_16CH_I2C_ADDRESS 0b1100111 // HIGH FLOAT HIGH
463 // #define LTC24XX_16CH_I2C_ADDRESS 0b1100110 // HIGH FLOAT FLOAT
464 // #define LTC24XX_16CH_I2C_ADDRESS 0b0110101 // FLOAT LOW LOW
465 // #define LTC24XX_16CH_I2C_ADDRESS 0b0110111 // FLOAT LOW HIGH
466 // #define LTC24XX_16CH_I2C_ADDRESS 0b0110110 // FLOAT LOW FLOAT
467 // #define LTC24XX_16CH_I2C_ADDRESS 0b1000111 // FLOAT HIGH LOW
468 // #define LTC24XX_16CH_I2C_ADDRESS 0b1010101 // FLOAT HIGH HIGH
469 // #define LTC24XX_16CH_I2C_ADDRESS 0b1010100 // FLOAT HIGH FLOAT
470 // #define LTC24XX_16CH_I2C_ADDRESS 0b1000100 // FLOAT FLOAT LOW
471 // #define LTC24XX_16CH_I2C_ADDRESS 0b1000110 // FLOAT FLOAT HIGH
472 // #define LTC24XX_16CH_I2C_ADDRESS 0b1000101 // FLOAT FLOAT FLOAT
473
474 // I2C Addresses for 2/4 channel parts
475 // ADDRESS CA1 CA0
476 // #define LTC24XX_4CH_I2C_ADDRESS 0b0010100 // LOW LOW
477 // #define LTC24XX_4CH_I2C_ADDRESS 0b0010110 // LOW HIGH
478 // #define LTC24XX_4CH_I2C_ADDRESS 0b0010101 // LOW FLOAT
479 // #define LTC24XX_4CH_I2C_ADDRESS 0b0100110 // HIGH LOW
480 // #define LTC24XX_4CH_I2C_ADDRESS 0b0110100 // HIGH HIGH
481 // #define LTC24XX_4CH_I2C_ADDRESS 0b0100111 // HIGH FLOAT
482 // #define LTC24XX_4CH_I2C_ADDRESS 0b0010111 // FLOAT LOW
483 // #define LTC24XX_4CH_I2C_ADDRESS 0b0100101 // FLOAT HIGH
484 // #define LTC24XX_4CH_I2C_ADDRESS 0b0100100 // FLOAT FLOAT
485
486
487 // I2C Addresses for Single channel parts (LTC2481/83/85)
488 // ADDRESS CA1 CA0/f0*
489 // #define LTC24XX_1CH_I2C_ADDRESS 0b0010100 // LOW HIGH
490 // #define LTC24XX_1CH_I2C_ADDRESS 0b0010101 // LOW FLOAT
491 // #define LTC24XX_1CH_I2C_ADDRESS 0b0010111 // FLOAT HIGH
492 // #define LTC24XX_1CH_I2C_ADDRESS 0b0100100 // FLOAT FLOAT
493 // #define LTC24XX_1CH_I2C_ADDRESS 0b0100110 // HIGH HIGH
494 // #define LTC24XX_1CH_I2C_ADDRESS 0b0100111 // HIGH FLOAT
495
496
497 #endif // LTC24XX_general_H
498
LTC24XX_SPI_8bit_command_32bit_data
void LTC24XX_SPI_8bit_command_32bit_data(uint8_t cs, uint8_t adc_command, int32_t *adc_code)
Reads from LTC24XX ADC that accepts an 8 bit configuration and returns a 32 bit result.
Definition: LTC24XX_general.cpp:118
LTC24XX_SPI_8bit_command_24bit_data
void LTC24XX_SPI_8bit_command_24bit_data(uint8_t cs, uint8_t adc_command, int32_t *adc_code)
Reads from LTC24XX ADC that accepts an 8 bit configuration and returns a 32 bit result.
Definition: LTC24XX_general.cpp:195
i2c_address
uint8_t i2c_address
LTC24XX_SPI_2ch_ping_pong_24bit_data
void LTC24XX_SPI_2ch_ping_pong_24bit_data(uint8_t cs, uint8_t *adc_channel, int32_t *code)
Reads from LTC24XX two channel "Ping-Pong" ADC, placing the channel information in the adc_channel pa...
Definition: LTC24XX_general.cpp:239
adc_command
static uint8_t adc_command
Definition: DC2071AA.ino:111
LTC24XX_SPI_16bit_command_32bit_data
void LTC24XX_SPI_16bit_command_32bit_data(uint8_t cs, uint8_t adc_command_high, uint8_t adc_command_low, int32_t *adc_code)
Reads from LTC24XX ADC that accepts a 16 bit configuration and returns a 32 bit result.
Definition: LTC24XX_general.cpp:136
LTC24XX_SPI_8bit_command_16bit_data
void LTC24XX_SPI_8bit_command_16bit_data(uint8_t cs, uint8_t adc_command, int32_t *adc_code)
Reads from LTC24XX ADC that accepts a 8 bit configuration and returns a 16 bit result.
LTC24XX_SPI_16bit_command_24bit_data
void LTC24XX_SPI_16bit_command_24bit_data(uint8_t cs, uint8_t adc_command_high, uint8_t adc_command_low, int32_t *adc_code)
Reads from LTC24XX ADC that accepts a 16 bit configuration and returns a 32 bit result.
Definition: LTC24XX_general.cpp:216
LTC24XX_SPI_32bit_data
void LTC24XX_SPI_32bit_data(uint8_t cs, int32_t *adc_code)
Reads from LTC24XX ADC that has no configuration word and returns a 32 bit result.
Definition: LTC24XX_general.cpp:103
LTC24XX_I2C_16bit_command_32bit_data
int8_t LTC24XX_I2C_16bit_command_32bit_data(uint8_t i2c_address, uint8_t adc_command_high, uint8_t adc_command_low, int32_t *adc_code, uint16_t eoc_timeout)
Reads from LTC24XX ADC that accepts a 16 bit configuration and returns a 32 bit result.
Definition: LTC24XX_general.cpp:350
LTC24XX_diff_code_to_voltage
float LTC24XX_diff_code_to_voltage(int32_t adc_code, float vref)
Calculates the voltage corresponding to an ADC code, given the reference voltage. ...
Definition: LTC24XX_general.cpp:389
LTC24XX_I2C_32bit_data
int8_t LTC24XX_I2C_32bit_data(uint8_t i2c_address, int32_t *adc_code, uint16_t eoc_timeout)
Reads from LTC24XX ADC that has no configuration word and returns a 32 bit result.
Definition: LTC24XX_general.cpp:298
LTC24XX_I2C_8bit_command_32bit_data
int8_t LTC24XX_I2C_8bit_command_32bit_data(uint8_t i2c_address, uint8_t adc_command, int32_t *adc_code, uint16_t eoc_timeout)
Reads from LTC24XX ADC that accepts an 8 bit configuration and returns a 32 bit result.
Definition: LTC24XX_general.cpp:326
LTC24XX_calibrate_voltage
void LTC24XX_calibrate_voltage(int32_t zero_code, int32_t fs_code, float zero_voltage, float fs_voltage, float *LTC24XX_lsb, int32_t *LTC24XX_offset_code)
Calculate the lsb weight and offset code given a full-scale code and a measured zero-code.
Definition: LTC24XX_general.cpp:427
LTC24XX_diff_code_to_calibrated_voltage
float LTC24XX_diff_code_to_calibrated_voltage(int32_t adc_code, float LTC24XX_lsb, int32_t LTC24XX_offset_code)
Calculates the voltage corresponding to an ADC code, given lsb weight (in volts) and the calibrated A...
Definition: LTC24XX_general.cpp:409
LTC24XX_EOC_timeout
int8_t LTC24XX_EOC_timeout(uint8_t cs, uint16_t miso_timeout)
Checks for EOC with a specified timeout.
Definition: LTC24XX_general.cpp:82
LTC24XX_I2C_16bit_command_24bit_data
int8_t LTC24XX_I2C_16bit_command_24bit_data(uint8_t i2c_address, uint8_t adc_command_high, uint8_t adc_command_low, int32_t *adc_code, uint16_t eoc_timeout)
Reads from LTC24XX ADC that accepts a 16 bit configuration and returns a 32 bit result.
eoc_timeout
static uint16_t eoc_timeout
timeout in ms
Definition: LTC2492_Panel_Meter.ino:135
LTC24XX_SPI_24bit_data
void LTC24XX_SPI_24bit_data(uint8_t cs, int32_t *adc_code)
Reads from LTC24XX ADC that has no configuration word and returns a 32 bit result.
Definition: LTC24XX_general.cpp:176
LTC24XX_SE_code_to_voltage
float LTC24XX_SE_code_to_voltage(int32_t adc_code, float vref)
Calculates the voltage corresponding to an ADC code, given the reference voltage. ...
Definition: LTC24XX_general.cpp:375
LTC24XX_I2C_8bit_command_24bit_data
int8_t LTC24XX_I2C_8bit_command_24bit_data(uint8_t i2c_address, uint8_t adc_command, int32_t *adc_code, uint16_t eoc_timeout)
Reads from LTC24XX ADC that accepts an 8 bit configuration and returns a 32 bit result.
Definition: LTC24XX_general.cpp:268
LTC24XX_SPI_2ch_ping_pong_32bit_data
void LTC24XX_SPI_2ch_ping_pong_32bit_data(uint8_t cs, uint8_t *adc_channel, int32_t *code)
Reads from LTC24XX two channel "Ping-Pong" ADC, placing the channel information in the adc_channel pa...
Definition: LTC24XX_general.cpp:155
vref
float vref
Definition: LTC2492_Thermocouple_Meter.ino:129
adc_code
static uint32_t adc_code
Definition: DC2071AA.ino:113
LTC24XX_I2C_24bit_data
int8_t LTC24XX_I2C_24bit_data(uint8_t i2c_address, int32_t *adc_code, uint16_t eoc_timeout)
Reads from LTC24XX ADC that has no configuration word and returns a 32 bit result.