Hi,
I have a LPC55S16-EVK, and I'm using MCUXpresso IDE.
I'm working on a project that is based on lpcxpresso55s16_dev_composite_cdc_msc_bm demo, And I'm trying to add ADC support.
I want to use pin 11 (ADC0 Channel 3B) and pin 23 (ADC0 Channel 3A).
I soldered pin 11 and pin 23 to external wires that are connected to 2 terminals of the same resistor.
My goal is to measure the voltage drop on this resistor(difference between these 2 pins).
I configured the pins using config tool
I configured the clock
Peripheral:
And I copied the driver files (fsl_lpadc.*) from another demo to my drivers directory.
I tried to copy the main function code to my main function (just the relevant parts), and the code compiles, but the reads are wrong.
I read "46164" when I should read GND value.
I guess the problem is that I'm not selecting the correct pin.
How can I select, for example, pin 23 (ADC0 Channel 3A)?
#define DEMO_LPADC_BASE ADC0
#define DEMO_LPADC_USER_CHANNEL 3U
#define DEMO_LPADC_USER_CMDID 1U
More generic questions:
* How can I configure ADC to 16 bit resolution?
* Does the driver can measure the difference between 2 pins? or should I read both and calculate it myself?
* If I should do it myself, how can I define 2 ADC?
* How can I use an internal timer to read the ADC values every X seconds?
Thanks
Hello ,
About ADC channel and 16 bit resolution, you can config in "Conversion commands configuration" :
If can't get data, recommend first use ADC demo under SDK to test, and select and connect the right pin.
BR
Alice
Thanks