90 dac_voltage = (((float) dac_code / 65535.0) * (max_output - min_output)) + min_output;
100 float_code = 65535.0 * (dac_voltage - min_output) / (max_output - min_output);
101 float_code = (float_code > (floor(float_code) + 0.5)) ? ceil(float_code) : floor(float_code);
102 if (float_code < 0.0) float_code = 0.0;
103 if (float_code > 65535.0) float_code = 65535.0;
104 dac_code = (uint32_t) (float_code);
#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.
union LT_union_int32_4bytes data
void LTC2752_write(uint8_t cs, uint8_t dac_command, uint8_t dac_address, uint16_t data)
Transmits 24 bit input stream: 4-bit command + 4-bit don't-care + 16-bit data.
uint16_t LTC2752_voltage_to_code(float dac_voltage, float min_output, float max_output)
Calculate a LTC2752 DAC code given the desired output voltage and the minimum / maximum outputs for a...
#define output_low(pin)
Set "pin" low.
LT_SPI: Routines to communicate with ATmega328P's hardware SPI port.
LT_I2C: Routines to communicate with ATmega328P's hardware I2C port.
float LTC2752_code_to_voltage(uint16_t dac_code, float min_output, float max_output)
Calculate the LTC2752 DAC output voltage given the DAC code and and the minimum / maximum outputs for...