iso9001
Joined: 02 Dec 2003 Posts: 262
|
|
Posted: Mon Aug 30, 2004 12:17 pm |
|
|
Hmmm.... I see what you're saying. The line:
0000: 29 95 2D 96 C7 3E 70 3D
from my original data would be X*2, to get it back to captured number, then would be *1.5 to get the actuall count since I though timer1 was counting every 1us and its really every 1.5us...
Quote: |
The largest error is this one:
storage[i]=(fall-prise)/2;
|
I'm confused as to the fall-prise time problem... Both of those are CCP captured varaibles, so they should just be relative to each other, no? If there is a relative problem in the data I can sort it out, but shouldn't this be (332x - 272x) / 2== 30x where x is my ticks per uS? (I just picked easy numbers)
I have to use somthing other then microchips method b/c it doesnt count the low pulses, just the highs (i think). I need to count both.
When you say
Quote: | ... A div2 isn't enough, better try a div 10 (or a much faster div 16 which is basically a shift operation). |
You mean when I /2 to my pulse times or do you mean a DIV_2 or DIV_16 on the timer? I know none of my pulses except an inactive period will be more then 255, but I figured a /2 would let me store at most a 9 bit time. I see no problem trying out a /16 on my scaler.
I thought this was an OK way to go, it uses two ccps, but only one interupt... I think I understand things better in code cause English isn't exactly my strong point. |
|