3 posts / 0 new
Last post
atching
Offline
Last seen: 5 years 7 months ago
Joined: 2015-02-04 18:12
ADC issues

I'm having a hard time getting my ADC to work. I've followed the example and datasheets to get a sample from P0_2, but can't seem to get a full 0-1023 range that I should with a 10 bit ADC. From the datasheet, I should be maxing out at 1.2V, but I only get a value around 320 when I test it in the debugger with the pin connected to a power supply.

This is the code I use:

adc_init(GP_ADC_SE,0);
adc_enable_channel(ADC_CHANNEL_P02);
sample = adc_get_sample();
adc_disable();

I've reserved the pin as follows:

RESERVE_GPIO( ADC, GPIO_PORT_0, GPIO_PIN_2, PID_ADC );

Please let me know if anyone has successfully gotten an ADC pin to read the whole range.

atching
Offline
Last seen: 5 years 7 months ago
Joined: 2015-02-04 18:12
Turns out the 3x attenuator

Turns out the 3x attenuator was set as the default... Referred to http://support.dialog-semiconductor.com/using-adc-read-voltage-divider-v...

JE_Dialog
Offline
Last seen: 8 hours 31 sec ago
Staff
Joined: 2013-12-05 14:02
Thankyou Atching... we are

Thankyou Atching... we are working on an apps note for the ADC , since the  documentation in the datasheet is not that great right now with regard to configuration.. the attentuator has caught out a few people. Glad you got that working.

BR JE_Dialog