Author Topic: stm32f0  (Read 1663 times)

0 Members and 1 Guest are viewing this topic.

Offline alizare368Topic starter

  • Regular Contributor
  • *
  • Posts: 56
  • Country: de
stm32f0
« on: May 16, 2018, 02:08:14 pm »
HI
HOW CAN I CONTROL A PIN IN THE REGISTRY??

GPIOA->MODER ? 
GPIOA->IDR ?   
GPIOA->ODR ?
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11248
  • Country: us
    • Personal site
Re: stm32f0
« Reply #1 on: May 16, 2018, 03:15:40 pm »
It is time to give up on programming microcontrollers if you can't find a way to toggle a pin after all that time.

Show us your thinking, nobody will do your work for you, especially with primitive stuff like that.
Alex
 

Offline aandrew

  • Frequent Contributor
  • **
  • Posts: 277
  • Country: ca
Re: stm32f0
« Reply #2 on: May 16, 2018, 04:17:26 pm »
Not to mention with that kind of attitude. We are a community of volunteers. We don't owe you anything.

Show some respect: Ask your question clearly, show us what you have tried and what happened. There are literally hundreds of STM32 intro pages on the internet, not to mention dozens of demo videos by STMicro themselves.
 

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 8172
  • Country: fi
Re: stm32f0
« Reply #3 on: May 16, 2018, 06:50:32 pm »
HI
ENABLE RELEVANT PORTX CLOCK IN RCC->XXXENR
SET RELEVANT BITS IN GPIOX->MODER TO 00 FOR INPUT, OR 01 FOR OUTPUT
WRITE TO GPIOX->ODR TO SET THE OUTPUT VALUE
OR READ FROM GPIOX->IDR TO READ THE INPUT VALUE
 
The following users thanked this post: knapik, xaxaxa

Offline Gibson486

  • Frequent Contributor
  • **
  • Posts: 324
  • Country: us
Re: stm32f0
« Reply #4 on: May 17, 2018, 02:03:23 pm »
There are...at least.... a dozen places that will tell you how to do it if you google it.
 

Online newbrain

  • Super Contributor
  • ***
  • Posts: 1719
  • Country: se
Re: stm32f0
« Reply #5 on: May 17, 2018, 03:29:17 pm »
 >:D
There are several ways to monitor for changes in Windows regisrtry, either from C++ or from VB and PowerShell.
WMI might be good if you need an asynchronous notification, but simple timed polling in Powershell with Get-ItemProperties might be enough for a basic implementation.
I have not investigated if using a System.IO:FileSystemWatcher object works with a path from the Registry virtual FS provider.

Once you have this set up, you can write code for your F0 to act as a USB CDC device and toggle pins at your leisure according to commands sent by the Windows program on the relevant COM port. If you have Windows 10 no driver  or .inf is needed.
 >:D

Is that what you're after?
I somehow suspect it's not...but the question is not very clear, and does not show much effort in finding the answer by yourself.
Nandemo wa shiranai wa yo, shitteru koto dake.
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14464
  • Country: fr
Re: stm32f0
« Reply #6 on: May 17, 2018, 06:09:02 pm »
 :-DD
 

Offline jesuscf

  • Frequent Contributor
  • **
  • Posts: 499
  • Country: ca
Re: stm32f0
« Reply #7 on: May 19, 2018, 04:34:53 am »
I would recommend to check the user manual for details about the registers.  Something like this should help you get started:

#define BIT0 (1 << 0) ; BIT0 = 0x00000001
.
.
.
#define BIT31 (1 << 31)

// Output example
RCC->AHBENR |= BIT17; // peripheral clock enable for port A
// Make pin PA0 output
GPIOA->MODER |= BIT0;
GPIOA->MODER &= ~BIT1;
// To write to the pin use the ODR:
GPIOA->ODR |= BIT0; // PA0=1
GPIOA->ODR &= ~BIT0; // PA0=0

// Input example
RCC->AHBENR |= BIT17; // peripheral clock enable for port A
GPIOA->MODER &= ~(BIT16 | BIT17); // Make pin PA8 input.
// Activate pull up for pin PA8
GPIOA->PUPDR |= BIT16;
GPIOA->PUPDR &= ~(BIT17);
// Read the pin and display
printf("PA8=%c\r", (GPIOA->IDR&BIT8)?'1':'0');

Homer: Kids, there's three ways to do things; the right way, the wrong way and the Max Power way!
Bart: Isn't that the wrong way?
Homer: Yeah, but faster!
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf