cancel
Showing results for 
Search instead for 
Did you mean: 

hello, may i know which code can i refer for ADC potentiometer ?

Angle
Associate II
 
This discussion has been locked for participation. If you have a question, please start a new topic in order to ask your question
14 REPLIES 14

if i used the potentiometer on pin PI[1] and PI[2], which part in the code that explain about the pin number/ where i need to modified the code for pin number?

ODOUV.1
ST Employee

ion default example, the SARADC supervisor0 is used:

 /* change driverUnderTest value to test others SARADC modules. */

 driverUnderTest = &SARADC12DSV;

corresponding into low level driver component to this check box:

0693W00000QKGIVQA5.png 

the channel used in channel 1:

uint8_t anp[NUMOFCHANNELS] = {1U};

in Reference Manual, it correspond to pin PB[6]:

0693W00000QKGjkQAH.png 

you can verify it in the outline of the pinmap tool:

0693W00000QKGkEQAX.pngANP1 correspond to pin PB[6]

On your side, if you want to use for example PI[1] as analogue input, then use the pinmap tool to do so

0693W00000QKGlMQAX.png 

and then you will have to enable channel5 ANP5 of ADC_12b_1

ODOUV.1
ST Employee

of course you will have to reconfigure the low level driver component to enable ADC_12b_1 and configure channel 5 of ADC_1 instead of channel1 of ADC_SV0 which is the default example

ohh i understand. Btw where can i get this reference manual ?

ODOUV.1
ST Employee