|
|
View previous topic :: View next topic |
Author |
Message |
mutevaggil
Joined: 29 May 2008 Posts: 8
|
missing pulses in counting |
Posted: Thu May 29, 2008 9:32 am |
|
|
hi, i am programming a pulse counter. there is a proximity sensor... my program takes its movement as pulses. it works. but if speed rise, it is happening some missing pulses, rarely but exist.
how can I do not to miss pulse and counts exactly.
by the way, i use capture compare module |
|
|
RLScott
Joined: 10 Jul 2007 Posts: 465
|
Re: missing pulses in counting |
Posted: Thu May 29, 2008 9:39 am |
|
|
mutevaggil wrote: | hi, i am programming a pulse counter. there is a proximity sensor... my program takes its movement as pulses. it works. but if speed rise, it is happening some missing pulses, rarely but exist.
how can I do not to miss pulse and counts exactly.
by the way, i use capture compare module |
You must decide how close together the pulses can be, and then determine how frequently your program is checking for the pulses. If you are counting pulses in your CCP interrupt service routine, and if that
routine takes too much time, then you might easily miss some pulses.
Just because you are using a C compiler, that does not relieve you of the responsibility of checking for time-critical code. It is useful to examine the disassembly listing and count instructions to see how long things take. Or, your could toggle unused outputs at certain places in your code and then measure the timing of those outputs with a 'scope.
Robert Scott
Real-Time Specialties |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|