using at mega 8

Go To Last Post
16 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

how i can using input capture for measurement frequency
square signal

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It is easier to just do it 'manually' at first. Just turn on timer1 and let it run. Read the input in a tight loop till it goes lo. Clear the timer. Wait in a tight loop till it goes hi. Wait in a tight loop till it goes lo a second time. Read the timer.

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

bobgardner wrote:
It is easier to just do it 'manually' at first. Just turn on timer1 and let it run. Read the input in a tight loop till it goes lo. Clear the timer. Wait in a tight loop till it goes hi. Wait in a tight loop till it goes lo a second time. Read the timer.

please tell me clearly how i can do that??i want formula for determine to tell me frequency i know must be using timer1 for this work but i want formula for specify frequency also tell me how do that but tell me that by code

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Have you read about ICP in the datasheet?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What part of my message wasn't clear? I can copy it again, or you can scroll back and read it again. The chapter on timers in the ds tells how to start it and stop it and set the prescaler that divides the avr clock down for the timer. Do you want a complete compilable program that measures frequency? In a perfect world, you could compile it, load it into your avr, and it would run. Just like a pc program will usually load up and run. There are a few things that might be different. What if my mega32 board runs the uart at a different baud rate than your mega328? Can you edit the c source, recompile, reburn and run? What if the example program is written for a different compiler than the one you use?

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

"For every effect there is a root cause. Find and address the root cause rather than try to fix the effect, as there is no end to the latter."
Author Unknown

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
Have you read about ICP in the datasheet?

yes

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

bobgardner wrote:
What part of my message wasn't clear? I can copy it again, or you can scroll back and read it again. The chapter on timers in the ds tells how to start it and stop it and set the prescaler that divides the avr clock down for the timer. Do you want a complete compilable program that measures frequency? In a perfect world, you could compile it, load it into your avr, and it would run. Just like a pc program will usually load up and run. There are a few things that might be different. What if my mega32 board runs the uart at a different baud rate than your mega328? Can you edit the c source, recompile, reburn and run? What if the example program is written for a different compiler than the one you use?

dear my purpose:how i can measure that frequency square signal whenever arrived signal to my micro controller i want measure frequncy that signal by input capture and send that frequency to LCD i know if i using OVF i can do it but i want using input capture how i can determine period if i using input capture i need period time because f=1/t if you have any idea for that please tell me !!!!!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


thank you alex if you have any idea for changing variable to string from C language programming micro controller please tell me :)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Buy a pencil and paper. The solution is obvious.

For regular 1Hz - 500kHz, you don't even need to be careful. You can read up to 8MHz but this requires efficient coding.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

zryan_s wrote:
if you have any idea for changing variable to string...

What kind of variable?

Alex

"For every effect there is a root cause. Find and address the root cause rather than try to fix the effect, as there is no end to the latter."
Author Unknown

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Attention to Arabic speakers of English: don't call a guy Dear. That is what you call your girlfriend or your wife.

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

bobgardner wrote:
Attention to Arabic speakers of English: don't call a guy Dear. That is what you call your girlfriend or your wife.

hhhhh,iam very sorry

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

alexan_e wrote:
zryan_s wrote:
if you have any idea for changing variable to string...

What kind of variable?

Alex


char or int

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

go to ask dana hhhhhhhhhh

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

danasorani wrote:
go to ask dana hhhhhhhhhh

sa3at chand