Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
7 years, 8 months ago.
MORE CODE EXAMPLES FOR THE MAX32630FTHR ADC
After reading through the MAX32630 datasheet, it is clear that the 10-bit ADC can be configured to do a lot more than the simplistic mbed AnalogIn class permits. Are there any code examples that show how to directly address the ADC registers? I would like to write my own library for this section of the device. Has anyone attempted this yet?
Question relating to:
1 Answer
7 years, 8 months ago.
Maxim has an ADC library that is included in the mbed library behind the mbed APIs. You can use that library by adding:
#include "adc.h"
You need to use the mbed-dev library to get the source code.
The Maxim libraries are in the mxc folder under the MAX32630 target: https://developer.mbed.org/users/mbed_official/code/mbed-dev/file/612c381a210f/targets/TARGET_Maxim/TARGET_MAX32630/mxc
Here is an example program:
Import programMAX_ADC
Maxim ADC Library Example
Thank you Greg!
This was very helpful. Where is the adc.h file stored? I could not find it within the mbed class files section, so I have been trying to understand the details of your code example.
</CODE> ADC_StartConvert(ADC_CH_0_DIV_5, 0, 1); AIN0 div 5 overflow = (ADC_GetData(&adc_value) == E_OVERFLOW ? 1 : 0); </END CODE>
The ADC statement starts a conversion, passing three parameters, channel, ?, and ?What are the second and third parameters? What is the purpose of the overflow statement, a "call back" function?
Best Regards,
Bill
posted by 13 Mar 2017