cancel
Showing results for 
Search instead for 
Did you mean: 

how to program a potentiometer

cyril2399
Associate II
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
5 REPLIES 5
Andrew Neil
Evangelist III
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...

cyril2399
Associate II
Posted on July 12, 2011 at 10:50

which example should I look?

thanks

Andrew Neil
Evangelist III
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.

raptorhal2
Lead
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
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