RPM Gage???
krazyideas
Posts: 119
Hello
I'm building an RPM gage.·
I have a intervol that I know is 10 degrees of rotation.
I think that the following program will work.
I reset the PHSA to zero each loop,· I think I have CTRA set to count at the same speed as the system clock.
Then I Moniter pin 21 and get the PHSA·value when·pin 21 goes high and·then again when pin 21 goes low.
Then I subtract the two PHSA values to get the amount of time it took for 10 degrees of rotation ·to pass.
Then I multiply that by 36 to get the time it takes for one rotation, Then I divide·that by clkfreq (Which·I think is·the # of Clock ticks in one second) then multiply that by 60 to get Rotations Per Minute.
I think that·will work??
Any help or thoughts would wonderful.
I got help for this same questions a couple months ago but I lost it some how. So sorry to ask the same question twice.
Thanks take care all
PUB RPM
CTRA := %10101 << 26
repeat
·
· PHSA := 0
·
· waitpeq (| < ·21, | < 21, 0)
· measure1 := PHSA
· waitpne (| < 21, | < 21, 0)
· measure2 := PHSA
··RPM := (((measure2 - measure1) * 36) / clkfreq) * 60)
·
I'm building an RPM gage.·
I have a intervol that I know is 10 degrees of rotation.
I think that the following program will work.
I reset the PHSA to zero each loop,· I think I have CTRA set to count at the same speed as the system clock.
Then I Moniter pin 21 and get the PHSA·value when·pin 21 goes high and·then again when pin 21 goes low.
Then I subtract the two PHSA values to get the amount of time it took for 10 degrees of rotation ·to pass.
Then I multiply that by 36 to get the time it takes for one rotation, Then I divide·that by clkfreq (Which·I think is·the # of Clock ticks in one second) then multiply that by 60 to get Rotations Per Minute.
I think that·will work??
Any help or thoughts would wonderful.
I got help for this same questions a couple months ago but I lost it some how. So sorry to ask the same question twice.
Thanks take care all
PUB RPM
CTRA := %10101 << 26
repeat
·
· PHSA := 0
·
· waitpeq (| < ·21, | < 21, 0)
· measure1 := PHSA
· waitpne (| < 21, | < 21, 0)
· measure2 := PHSA
··RPM := (((measure2 - measure1) * 36) / clkfreq) * 60)
·
Comments
text.str (string("RPM "))
text.dec (RPM)
http://forums.parallax.com/showthread.php?p=765478
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Aka: CosmicBob
do you have a TV ?
then just test it
best regards
Stefan