Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

how atmega16 microcontroller knows whether given pulses is 2 or 3

Status
Not open for further replies.

nishahv

Newbie level 4
Joined
Feb 11, 2012
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,317
how atmega16 microcontroller knows whether given pulses is 2 or 3
 

2 or 3 what??
please explain yourself
 

The ATMEGA16 doesn't know anything. You have to make it know if there are 2 or 3 given pulses.

What exactly do you mean by 2 or 3 pulses? Does it mean that you have an input that gives 2 or 3 pulses/cycles?
 

A very interesting question. Hard to understand but maybe very important...
 

There are a few ways to do it,
you can use the external interrupt set to trigger with a rising edge or a falling edge,
you can use a timer that uses as a clock source an external pin (set to falling or rising edges),
you can use the input capture unit (set to falling or rising edges),
even the analog comparator can be used or even detect the input in a loop.
 

Actually the problem is deeper - the number of pulses have to be seen in the time domain, i.e. it's not only to count 2-3 pulses but also to know the time interval in which they occurred. The best way to count the pulses is to connect the source of the pulses to one of the counters. Each 100ms to check the status of the counter and to have some algorithm to see if the pulses occurred in 2s, 20s or one hour.
 

It depends on what you are trying to count, the OP asked how to count pulses and that doesn't involve any pulse width measurement or timing.
 

Hi Alexan_n,
I agree with you, but soon or later he'll come to the idea that just counting the pulses outside of the time domain doesn't make sense.
 

luben111 said:
soon or later he'll come to the idea that just counting the pulses outside of the time domain doesn't make sense.
Hello luben111!

We don't know that. There is a chance that a number of asynchronous pulses are needed to trigger an event or added to a variable. From all the billions of applications in this world, does it seem strange if someone, somewhere needed something like that?
 

Hi all... I'm also having problem with similar kind of application... My project is on speed control of Fan... Here Consider if I give 1 pulse(High to low) then the spped should be some value say 300 rpm, If I give another pulse, speed=500rpm n so on... but my problem is How to sense a high to low Pulse given to muc??? Thanks in advance...
 

Hi all... I'm also having problem with similar kind of application... My project is on speed control of Fan... Here Consider if I give 1 pulse(High to low) then the spped should be some value say 300 rpm, If I give another pulse, speed=500rpm n so on... but my problem is How to sense a high to low Pulse given to muc??? Thanks in advance...
I tried to understand the exact problem, but unfortunately I didn't make it... :)
Your problem is with driving? If so, then the PWM module will do the desired job for you. You need to start and stop PWM whenever you wish. While PWM is running, you can set the duty cycle whenever you like, without the need of stopping it first.
If the problem is with reading (like when you have an encoder or something for feedback), then you can measure time from high to low and vice versa, and in this way you can make a conclusion about speed. You could use an external interrupt for this on both transitions from 0 to 1 and from 1 to 0.

Hope it helped,
Alexandros
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top