Skip to main content
Visitor II
March 28, 2018
Question

i am using stm8af6223pcu , i am unable to read 0-3 khz frequency input signal to the microcontroller.please give me any suggesion or code related to that.

  • March 28, 2018
  • 3 replies
  • 1208 views
Posted on March 28, 2018 at 08:28

I want to use 3 khz frequency signal has input to the micro controller.

    This topic has been closed for replies.

    3 replies

    Visitor II
    March 28, 2018
    Posted on March 28, 2018 at 08:48

    Hi,

    i am unable to read 0-3 khz frequency input signal to the microcontroller please give me any suggesion or code related to that

    - You can always read input signals by configuring GPIO pins as inputs and setting the speed(max frequency limit) which is greater than the input signal

    i am unable to read 0-3 khz frequency input signal to the microcontroller please give me any suggesion or code related to that

    - What did you try so far?

    gopi vhAuthor
    Visitor II
    March 28, 2018
    Posted on March 28, 2018 at 12:19

    i have tried through ADC pin(ANI) but could not read.

    gopi vhAuthor
    Visitor II
    March 28, 2018
    Posted on March 28, 2018 at 13:02

    i have used pin number 2(PD5/ AIN5),from that pin i tried to capture the frequency signal coming from sensor (3KHZ ).

    we have to measure that signal and to indicate how much frequency is coming.

    Graduate II
    March 28, 2018
    Posted on March 28, 2018 at 13:32

    You'd likely want to use a TIM in Input Capture, PWM Input, or External Count mode. At that point you're looking to measure the period, or get a count over an integration period.

    Visitor II
    March 29, 2018
    Posted on March 29, 2018 at 13:28

    i have tried through ADC pin(ANI) but could not read.

    You cannot measure frequency using ADC peripheral. You have to configure the PD5 as an alternate function timer in INPUT CAPTURE mode either to count rising or falling edges of input signal. After this, get the value from corresponding CCR register, divide this value from system clock frequency to get the frequency of input signal.

    Visitor II
    March 30, 2018
    Posted on March 30, 2018 at 02:05

    '

    You cannot measure frequency using ADC peripheral.'

    you certainly can. but it is generally unwise to do so.