75 void LTC2604_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 - LTC2604_offset;
99 return ((uint16_t)dac_code);
106 dac_voltage = ((float)(dac_code + LTC2604_offset)*
LTC2604_lsb);
107 return (dac_voltage);
float LTC2604_code_to_voltage(uint16_t dac_code, float LTC2604_lsb, int16_t LTC2604_offset)
Calculate the LTC2604 DAC output voltage given the DAC code, offset, and LSB value.
Header File for Linduino Libraries and Demo Code.
uint16_t LTC2604_voltage_to_code(float dac_voltage, float LTC2604_lsb, int16_t LTC2604_offset)
Calculate a LTC2604 DAC code given the desired output voltage and DAC address (0-3) ...
union LT_union_int32_4bytes data
uint16_t LT_uint16
16-bit unsigned integer to be converted to two bytes
static float LTC2604_lsb[4]
LT_SPI: Routines to communicate with ATmega328P's hardware SPI port.
void LTC2604_write(uint8_t cs, uint8_t dac_command, uint8_t dac_address, uint16_t dac_code)
Write the 16-bit dac_code to the LTC2604.
static int16_t LTC2604_offset
This union splits one int16_t (16-bit signed integer) or uint16_t (16-bit unsigned integer) into two ...
LTC2604: Quad 16-Bit Rail-to-Rail DACs in 16-Lead SSOP.
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 ...