updated dac and adc code