added adc error handling function