ltc2484 Linear Technology Corporation, ltc2484 Datasheet - Page 38

no-image

ltc2484

Manufacturer Part Number
ltc2484
Description
24-bit Delta Sigma Adc With Easy Drive Input Current Cancellation
Manufacturer
Linear Technology Corporation
Datasheet

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
ltc2484CDD
Manufacturer:
LT
Quantity:
10 000
Part Number:
ltc2484IDD
Manufacturer:
LT
Quantity:
10 000
Part Number:
ltc2484IDD#PBF
Manufacturer:
LINEAR/凌特
Quantity:
20 000
APPLICATIO S I FOR ATIO
LTC2484
/*** read_LTC2484() ************************************************************
This is the function that actually does all the work of talking to the LTC2484.
The spi_read() function performs an 8 bit bidirectional transfer on the SPI bus.
Data changes state on falling clock edges and is valid on rising edges, as
determined by the setup_spi() line in the initialize() function.
A good starting point when porting to other processors is to write your own
spi_write function. Note that each processor has its own way of configuring
the SPI port, and different compilers may or may not have built-in functions
for the SPI port. Also, since the state of the LTC2484’s SDO line indicates
when a conversion is complete you need to be able to read the state of this line
through the processor’s serial data input. Most processors will let you read
this pin as if it were a general purpose I/O line, but there may be some that
don’t.
When in doubt, you can always write a “bit bang” function for troubleshooting
purposes.
The “fourbytes” structure allows byte access to the 32 bit return value:
struct fourbytes
Also note that the lower 4 bits are the configuration word from the previous
conversion. The 4 LSBs are cleared so that
they don’t affect any subsequent mathematical operations. While you can do a
right shift by 4, there is no point if you are going to convert to floating point
numbers - just adjust your scaling constants appropriately.
*******************************************************************************/
signed int32 read_LTC2484(char config)
// Now is the time to switch any multiplexers because the conversion is finished
// and you have the whole data output time for things to settle.
// Clear configuration bits and subtract offset. This results in
// a 2’s complement 32 bit integer with the LTC2484’s MSB in the 2^20 position
38
{
int8 te0;
int8 te1;
int8 te2;
int8 te3;
};
{
union
output_low(CS);
while(input(PIN_C4)) {}
adc_code.by.te3 = 0;
adc_code.by.te2 = spi_read(config);
adc_code.by.te1 = spi_read(0);
adc_code.by.te0 = spi_read(0);
output_high(CS);
adc_code.by.te0 = adc_code.by.te0 & 0xF0;
adc_code.bits32 = adc_code.bits32 - 0x00200000;
return adc_code.bits32;
} // End of read_LTC2484()
{
signed int32 bits32;
struct fourbytes by;
} adc_code;
U
// Define structure of four consecutive bytes
// To allow byte access to a 32 bit int or float.
//
// The make32() function in this compiler will
// also work, but a union of 4 bytes and a 32 bit int
// is probably more portable.
U
W
// adc_code.bits32
// adc_code.by.te0
// adc_code.by.te1
// adc_code.by.te2
// adc_code.by.te3
// Enable LTC2484 SPI interface
// Wait for end of conversion. The longest
// you will ever wait is one whole conversion period
U
// Set upper byte to zero.
// Read first byte, send config byte
// Read 2nd byte, send speed bit
// Read 3rd byte. ‘0’ argument is necessary
// to act as SPI master!! (compiler
// and processor specific.)
// Disable LTC2484 SPI interface
all 32 bits
byte 0
byte 1
byte 2
byte 3
2484fa

Related parts for ltc2484