Page 1 of 1

Pulse counter (external signal) with a STM32F769I-DISCO board

Posted: Fri Mar 18, 2022 3:17 am
by donwynne
Hello everyone! I have to connect an inductive sensor to my STM32F769I-DISCO in order to count rising edges of an external signal. So, especially if you have already done that, I would need some advice about the inputs of my microcontroller I may use to carry out the connection with the inductive sensor.
By the way, to count rising edges, I am wondering which functions I could use. Otherwise, do you know a specific method for doing that?
I truly thank you in advance for your help (I'm still a newcomer in that field to be honest).
Sincerely,

Re: Pulse counter (external signal) with a STM32F769I-DISCO board

Posted: Fri Mar 18, 2022 10:40 am
by GonzoG
Just use interrupt.
eg:

Code: Select all

volatile uint32_t impulseCount=0;

void ISR(){
  impulseCount++;
}

void setup() {
  // put your setup code here, to run once:
  pinMode(<pin>,INPUT);
  attachInterrupt(<pin>,ISR,RISING);
}
Depending on your circuit and sensor, you might need to use pull down or pull up resistor on input pin.

Re: Pulse counter (external signal) with a STM32F769I-DISCO board

Posted: Fri Mar 25, 2022 9:40 am
by nektariosb
@GonzoG which pins can I use for external interrupt?
Thank you!

Re: Pulse counter (external signal) with a STM32F769I-DISCO board

Posted: Fri Mar 25, 2022 3:12 pm
by GonzoG
I think that STM32s can use any pin as an external interrupt.