PDA

View Full Version : Blink LED / Pulse 4026 based on Speed Word from Parallax GPS Module.



benoit2010
11-13-2011, 10:22 PM
Hi All,

I am trying to make a VFD speedometer using a three Russian IV-22 displays. I am driving the IV-22s with 4026 counter chips chips. The Propeller pulses the input of the first 4026. The output of the first 4026 drives the input of the second 4026 etc. This displays the number of pulses as a 3 digit number.

I have connected the Parallax GPS module to the Propellor and used the GPS Smart Mode Demo to generate the pulses. The code also pulses one of the LEDs on the propellor demo board.

I have modified the GPS smart mode to display the speed in knots rather than convert the speed to miles per hour.

In GPS_SmartMode.spin I changed this:


PUB GetSpeed
'' Speed is returned from the GPS module in knots; convert to MPH
'' 1 knot = 1.1507771555 MPH
return ReadTenthsAndScale(GPS_GetSpeed, 1.1507771555)

To this:


PUB GetSpeed
'' Speed is returned from the GPS module in knots;
return GetGPSWord(GPS_GetSpeed)

If I write the code to display the number of satellites (which is a byte) the VFD display the number of satellites fine. When I change the code to display the speed (which is a word) the VFD doesn't display the speed and the LED on the demo board doen't pulse.

Any help is greatly appreciated.

Benoit

86820

kuroneko
11-13-2011, 11:42 PM
The GetSpeed method is supposed to return a floating point number (which is true when ReadTenthsAndScale is used). Try

PUB GetSpeed

return F.FDiv(F.FFloat(GetGPSWord(cmd)), 10.0)
This is based on what the original implementation did but without the scaling. Alternatively you could have set the scaling factor to -1.0 like in the GetHeading method.

Given the number format you might want to rethink the repeat GPS.GetSpeed in your BlinkSpeed method.

benoit2010
11-14-2011, 01:07 AM
Thank you Kuroneko, I will try what you have suggested tonight, with the scaling set to -1.0.

I was trying to keep the GetSpeed value as an integer as I thought a floating point value would mess up the BlinkSpeed method.

kuroneko
11-14-2011, 01:30 AM
I was trying to keep the GetSpeed value as an integer as I thought a floating point value would mess up the BlinkSpeed method.
You could do that but then you'll have to print it as in integer (no float-to-string conversion). Whatever is most useful/convenient.