However when I input a 50.6 hz to pin5 the output value shown on the lcd displayer is 8117 .Is there anyways, i can change it into decimal value and display 0.0198 on the displayer?
how long is the rising time of a square wave with 50 HZ
I want to print out the period of the signal .which is equal to 1/50.6=0.197Check your math as that should = 0.0197 seconds, so for one half the period (you are only measuring the positive half of the signal frequency) would be = to .009881 seconds or 9881 usec. So you are measuring about 18% fast which could be just not having an accurate signal generator or possibly noisy zero crossing detection causing an inaccurate 50% duty cycle, and you are only taking a single snap shot measurement rather then say taking a few and averaging them. I played with the pulse in command some a long while back and was not too pleased with it, as I never seemed to get real stable results on a constant frequency input, but never tracked down the cause of the variation even though I was using a good quality signal generator. Possibly millis and micros interrupts could be 'skewing' the results randomly?Lefty I want to know that is the value of duration equal to the length of the rise time ?which is equal to half of the period 0.197/2.Now the displayer just shown as 8117Is there anything i can convert the value from 8117 to the period
If you read through some of the previous responses you will see that that approach will double any errors.Duane Brcarduino.blogspot.com
Please enter a valid email to subscribe
We need to confirm your email address.
To complete the subscription, please click the link in the
email we just sent you.
Thank you for subscribing!
via Egeo 16