Author Topic: stm32f0  (Read 591 times)

0 Members and 1 Guest are viewing this topic.

Offline alizare368

  • Contributor
  • Posts: 5
  • Country: de
stm32f0
« on: May 17, 2018, 12:08:14 am »
HI
HOW CAN I CONTROL A PIN IN THE REGISTRY??

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

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 4534
  • Country: us
    • Personal site
Re: stm32f0
« Reply #1 on: May 17, 2018, 01:15:40 am »
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

  • Regular Contributor
  • *
  • Posts: 164
  • Country: ca
Re: stm32f0
« Reply #2 on: May 17, 2018, 02:17:26 am »
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.
 

Online Siwastaja

  • Super Contributor
  • ***
  • Posts: 1224
  • Country: fi
Re: stm32f0
« Reply #3 on: May 17, 2018, 04:50:32 am »
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

  • Regular Contributor
  • *
  • Posts: 180
  • Country: us
Re: stm32f0
« Reply #4 on: May 18, 2018, 12:03:23 am »
There are...at least.... a dozen places that will tell you how to do it if you google it.
 

Online newbrain

  • Frequent Contributor
  • **
  • Posts: 528
  • Country: se
Re: stm32f0
« Reply #5 on: May 18, 2018, 01:29:17 am »
 >: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.
For the Snark was a Boojum, you see.
 

Offline SiliconWizard

  • Frequent Contributor
  • **
  • Posts: 560
  • Country: fr
Re: stm32f0
« Reply #6 on: May 18, 2018, 04:09:02 am »
 :-DD
 

Offline jesuscf

  • Regular Contributor
  • *
  • Posts: 120
  • Country: ca
Re: stm32f0
« Reply #7 on: May 19, 2018, 02:34:53 pm »
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