cancel
Showing results for 
Search instead for 
Did you mean: 

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.

gopi vh
Associate II
Posted on March 28, 2018 at 08:28

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

7 REPLIES 7
GenuineDeveloper
Associate III
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 vh
Associate II
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.

Posted on March 28, 2018 at 12:19

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

Posted on March 28, 2018 at 12:24

'

please give me any suggesion'

post your code.

'

or code related to that '

no.

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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
GenuineDeveloper
Associate III
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.

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.