hi all,
is there a convenient way, either graphically or C code to implement a pull up on a digtial input for STM32f0 processors?
input pullups - ARM processor, STM32f0..
-
- Posts: 5
- http://meble-kuchenne.info.pl
- Joined: Tue Feb 14, 2023 5:07 pm
- Has thanked: 2 times
- Been thanked: 2 times
-
- Matrix Staff
- Posts: 1269
- Joined: Sat Dec 05, 2020 10:32 am
- Has thanked: 168 times
- Been thanked: 285 times
Re: input pullups - ARM processor, STM32f0..
I am not familiar with that range of devices, but looking at the datasheet there is a register that controls the internal weak pull-ups and pull-downs for the I/O ports (GPIOx_PUPDR).
Re: input pullups - ARM processor, STM32f0..
so will the flowcode IDE support a discrete C code write to this register via a Code Command icon? will the compiler understand or recognise that register name?
Could you provide an example of how this would be done? - i purchased the FLOWCODE ARM version for training only,i was hoping this would be straighforward, before i consider purchasing a professional license.
Could you provide an example of how this would be done? - i purchased the FLOWCODE ARM version for training only,i was hoping this would be straighforward, before i consider purchasing a professional license.
-
- Matrix Staff
- Posts: 1756
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 446 times
- Been thanked: 606 times
Re: input pullups - ARM processor, STM32f0..
Hello,
This reply on our old forum might be useful for you.
https://www.matrixtsl.com/mmforums/view ... 272#p92272
This reply on our old forum might be useful for you.
https://www.matrixtsl.com/mmforums/view ... 272#p92272
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
-
- Valued Contributor
- Posts: 401
- Joined: Mon Dec 07, 2020 1:00 pm
- Has thanked: 73 times
- Been thanked: 218 times
Re: input pullups - ARM processor, STM32f0..
To simplify the C code, add these definitions into the Project Options -> Supplementary Code -> Definitions
Then, as an example, to turn on pullup to port B pin 8, add this into a C icon
nb. You will still need to use C code to read the pin, as mentioned in the post linked by Ben.
Hope that helps.
Code: Select all
#define PULL_UP(port, pin) GPIO##port->PUPDR |= (1 << (pin *2))
#define PULL_DOWN(port, pin) GPIO##port->PUPDR |= (2 << (pin *2))
Code: Select all
PULL_UP(B, 8);
Hope that helps.