95 voltage = (RANGE_HIGH - RANGE_LOW) * data / 0xFFFF + RANGE_LOW;
103 code = (voltage - RANGE_LOW) * (0xFFFF / (RANGE_HIGH - RANGE_LOW));
float LTC1592_code_to_voltage(uint16_t data, float RANGE_HIGH, float RANGE_LOW)
Calculates the voltage from ADC output data depending on the channel configuration.
#define output_high(pin)
Set "pin" high.
Header File for Linduino Libraries and Demo Code.
void spi_write(int8_t data)
Write a data byte using the SPI hardware.
void LTC1592_write(uint8_t cs, uint8_t dac_command, uint16_t data)
Transmits 24 bit input stream: 4-bit command + 4-bit don't-care + 16-bit data.
union LT_union_int32_4bytes data
#define output_low(pin)
Set "pin" low.
LT_SPI: Routines to communicate with ATmega328P's hardware SPI port.
uint16_t LTC1592_voltage_to_code(float voltage, float RANGE_HIGH, float RANGE_LOW)
Calculates the 16 bit data code from voltage.