3 posts / 0 new
Last post
atching
Offline
Last seen:6 years 1 month ago
加入: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:6 years 1 month ago
加入:2015-02-04 18:12
Turns out the 3x attenuator

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

JE_Dialog
Offline
Last seen:3 weeks 2 days ago
工作人员
加入: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