LTC2418, typical python code
Python code fragments are presented here, taking data from using an LTC2418 ADC: First load in the Almike Labs-supplied library, then call it. The library is high level, and only requires basic setup (channel number, single ended or differential input etc).
# python function to take data from LTC2418:
def get_adc_LTC2418_v3(style,update_set,f_channel,trace,speed,CE,time_to_sleep):
"""
Acquire one sample of data from LTC2418 chip in 8 channel, differential input mode
Inputs: style = "SE" or "DIF"
update_set = "SET" or "KEEP"
channel number (0 to 15)
trace if 0 then no diagnostic output
if 1 then diagnostic output
spi speed (often 7629)
ce (must be 0 or 1)
time_to_sleep (seconds) typically about 0.3 to 0.5
Outputs: a list, list[0] is the actual data
list[1] is a diagnostic list [val1,chan_readback,parity_bit,sign,r]
so for example chan_readback would be list[1][1]
# calling the python function to take data from LTC2418:
a = get_adc_LTC2418_v3(style,update_set,channel,trace,speed,CE,time_to_sleep)
# typically the user would save this return data in a data base etc, then move on to take more samples.