RPM/MPH help please
I'm using the Melexis 90217 Hall-Effect Sensor, with the prop. I'm using the motor minder code. I've hooked it up per motor minder pin 7, and per the milling rpm basic stamp page. I've tried running pin1 of the sensor to 5v+ or the 3.3v+. I wasn't sure if the sensor's pin3 to pin7 of the prop should go through a resistor or not with using the 5v supply with the sensor. I'm running off a fresh 6v lantern battery. The capacitor is is the ceramic disk type 0.01uf. I did read earlier that someone was able to use it on 3.3v even though it like 3.5v, and increased the capacitor.
The problem I'm having is it showing rpms when it should be zero. I just swing the magnet when necessary to test.
Please see my last post for lastest code
Post Edited (Capdiamont) : 9/21/2009 12:11:33 AM GMT
The problem I'm having is it showing rpms when it should be zero. I just swing the magnet when necessary to test.
Please see my last post for lastest code
Post Edited (Capdiamont) : 9/21/2009 12:11:33 AM GMT
Comments
rs_jim
{{ header }} CON _CLKMODE = XTAL1 + PLL16X ' 80 Mhz clock _XINFREQ = 5_000_000 RPSPin = 7 ' shaft encoder - Propeller pin ' F1 = 1.0 ' floating point 1 ' F60000 = 60_000.0 ' floating point 60,000 Diameter = 10.0 ' diameter of wheel in inches Circumference = Diameter * PI 'result in inches OBJ num : "simple_numbers" F : "FloatMath" FS : "FloatString" vp : "Conduit" VAR long RPS , RPM ' rev per second, and minute indexes long MPH, Odometer ' long IO ' to share io pin info byte RPMArray[noparse][[/noparse]60] , RPMI , RPMI_B ', MPH PUB Init ctrb[noparse][[/noparse]30..26] := %01010 'ctrb module to POSEDGE detector ctrb[noparse][[/noparse]8..0] := RPSPin 'count revelutions per second frqb := 1 'Add 1 for each cycle vp.share(@RPS,@RPMI_B) 'allow sharing of first to last varable to viewpoint for debuging uses addresses of varables Odometer~ repeat IO:=INA phsb~ waitcnt(clkfreq + cnt) RPS := (phsb) Odometer += RPS RPMArray[noparse][[/noparse]RPMI++] := RPS 'store RPseconds in a different place each second If RPMI =>= 60 RPMI~ '60 is above range of array, so reset to zero RPM~ 'zero out rpm before adding together array repeat RPMI_B from 0 to 59 add up all the revs that happned in the minute RPM += RPMArray[noparse][[/noparse]RPMI_B] MPH := Circumference * RPM 'calcuate MP MPH *= 60 'make it hour time MPH /= 63360 'convert to mile from inches
Post Edited (Capdiamont) : 9/21/2009 12:13:44 AM GMT
I changed some of the code, hopefully it works, will have to test in the morning.
MPH := f.FMul(Circumference, FFloat(RPM))'calcuate MP MPH := f.FMul(MPH, 60.0) 'make it hour time MPH := f.fDiv(MPH, 63360.0) 'convert to milePH from inchesPH