75 void LTC2600_write(uint8_t cs, uint8_t dac_command, uint8_t dac_address, uint16_t dac_code)
77 uint8_t data_array[3], rx_array[3];
82 data_array[2] = dac_command | dac_address;
83 data_array[1] = data.
LT_byte[1];
95 float_code = (float_code > (floor(float_code) + 0.5)) ? ceil(float_code) : floor(float_code);
96 dac_code = (int32_t)float_code - LTC2600_offset;
99 return ((uint16_t)dac_code);
106 dac_voltage = ((float)(dac_code + LTC2600_offset)*
LTC2600_lsb);
107 return (dac_voltage);
LTC2600: Octal 16-Bit Rail-to-Rail DACs in 16-Lead SSOP.
static int16_t LTC2600_offset
Header File for Linduino Libraries and Demo Code.
float LTC2600_code_to_voltage(uint16_t dac_code, float LTC2600_lsb, int16_t LTC2600_offset)
Calculate the LTC2600 DAC output voltage given the DAC code, offset, and LSB value.
union LT_union_int32_4bytes data
uint16_t LTC2600_voltage_to_code(float dac_voltage, float LTC2600_lsb, int16_t LTC2600_offset)
Calculate a LTC2600 DAC code given the desired output voltage and DAC address (0-3) ...
uint16_t LT_uint16
16-bit unsigned integer to be converted to two bytes
LT_SPI: Routines to communicate with ATmega328P's hardware SPI port.
This union splits one int16_t (16-bit signed integer) or uint16_t (16-bit unsigned integer) into two ...
void LTC2600_write(uint8_t cs, uint8_t dac_command, uint8_t dac_address, uint16_t dac_code)
Write the 16-bit dac_code to the LTC2600.
void spi_transfer_block(uint8_t cs_pin, uint8_t *tx, uint8_t *rx, uint8_t length)
Reads and sends a byte array.
uint8_t LT_byte[2]
2 bytes (unsigned 8-bit integers) to be converted to a 16-bit signed or unsigned integer ...