Skip to main content
cyril2399
Associate III
July 12, 2011
Question

how to program a potentiometer

  • July 12, 2011
  • 5 replies
  • 994 views
Posted on July 12, 2011 at 09:24

hello,

I have the STM3210C eval board and there is a potentiometer linked at PC4.

I want to divide all the range into ten parts.

What should I do ?

I have try to do Read Input Data, and all the function ''read...'' present in stm32f10x_gpio.c

PC4 is always at zero....

Thank to all
    This topic has been closed for replies.

    5 replies

    Andrew Neil
    Super User
    July 12, 2011
    Posted on July 12, 2011 at 10:26

    A potentiometer will give you an analogue signal; GPIOs are digital  !

    Look at the examples included with the Standard Peripheral Library...

    A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
    cyril2399
    cyril2399Author
    Associate III
    July 12, 2011
    Posted on July 12, 2011 at 10:50

    which example should I look?

    thanks

    Andrew Neil
    Super User
    July 12, 2011
    Posted on July 12, 2011 at 12:29

    I suggest that you invest some time in taking a look through all  of them - to familiarise yourself with what's available.

    A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
    raptorhal2
    Lead
    July 12, 2011
    Posted on July 12, 2011 at 15:34

    When you get stuck on something, always Read The Fine Manual first.

    And after you follow Andrew's advice, go to the STM32F105/7 data sheet, Section 3 Pin Descriptions, Table 5 Pin Definitions where you will see that PC4 in alternate function mode is ADC channel 14.

    Then go to RM0008 Reference Manual Section 9 that describes alternate functions.

    This documentation is available on ST's web site associated with the processor you are using.

    Cheers, Hal

    raptorhal2
    Lead
    July 12, 2011
    Posted on July 12, 2011 at 15:34

    When you get stuck on something, always Read The Fine Manual first.

    And after you follow Andrew's advice, go to the STM32F105/7 data sheet, Section 3 Pin Descriptions, Table 5 Pin Definitions where you will see that PC4 in alternate function mode is ADC channel 14.

    Then go to RM0008 Reference Manual Section 9 that describes alternate functions.

    This documentation is available on ST's web site associated with the processor you are using.

    Cheers, Hal