Skip to main content
Angle
Associate III
July 1, 2022
Solved

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

  • July 1, 2022
  • 7 replies
  • 2247 views

..

    This topic has been closed for replies.
    Best answer by ODOUV.1

    Hello,

    in SPC5Studio, click on 0693W00000QKGAaQAP.pngselect you product family:0693W00000QKGAfQAP.pngselect a product and click on next:0693W00000QKGAzQAP.pngselect a driver example:

    0693W00000QKGB4QAP.pngand finally select the demo application and click on finish:

    0693W00000QKGBEQA5.png 

    It is the same answer for any driver example, any product family

    Best regards

    7 replies

    Erwan YVIN
    ST Employee
    July 1, 2022

    hello ,

    Which MCU do you use ?

    please check the test Application in SPC5 families in SPC5Studio (ADC part)

    Best Regards

    Erwan

    Angle
    AngleAuthor
    Associate III
    July 1, 2022

    Hi Erwan,

    i'm using SPC57 (SPHAERO). Which one i need to select?0693W00000QKGCHQA5.png 

    ODOUV.1
    ODOUV.1Best answer
    ST Employee
    July 1, 2022

    Hello,

    in SPC5Studio, click on 0693W00000QKGAaQAP.pngselect you product family:0693W00000QKGAfQAP.pngselect a product and click on next:0693W00000QKGAzQAP.pngselect a driver example:

    0693W00000QKGB4QAP.pngand finally select the demo application and click on finish:

    0693W00000QKGBEQA5.png 

    It is the same answer for any driver example, any product family

    Best regards

    Angle
    AngleAuthor
    Associate III
    July 1, 2022

    what is different between "saradc_lld_cfg.h" and "adc_lld_cfg.h"? i got confuse between these two.

    ODOUV.1
    ST Employee
    July 1, 2022

    saradc_lld_cfg.h is the only one used on SPHAERO product, do not mind about other.

    Angle
    AngleAuthor
    Associate III
    July 1, 2022

    What means by {8U,9U} and {0U,0U} ? One more thing whats is "anp" stand for and function?.

    0693W00000QKGMMQA5.png

    ODOUV.1
    ST Employee
    July 1, 2022

    be careful, you are not looking to the SPHAERO demo (SPC574S) but to the VELVETY one (SPC570S) do you confirm you product is SPC574S ?

    ODOUV.1
    ST Employee
    July 1, 2022

    U is used to define unsigned immediate for MISRA purposes

    anp, I suppose it stands for analogue port ? as it is used to select analogue channels

    Angle
    AngleAuthor
    Associate III
    July 1, 2022

    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
    July 1, 2022

    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

    Angle
    AngleAuthor
    Associate III
    July 3, 2022

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

    ODOUV.1
    ST Employee
    July 1, 2022

    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

    ODOUV.1
    ST Employee
    July 4, 2022