Shop OBEX P1 Docs P2 Docs Learn Events
Blink LED / Pulse 4026 based on Speed Word from Parallax GPS Module. — Parallax Forums

Blink LED / Pulse 4026 based on Speed Word from Parallax GPS Module.

benoit2010benoit2010 Posts: 2
edited 2011-11-13 18:30 in Propeller 1
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

GPS_SmartMode_demo_VFD - Archive [Date 2011.11.14 Time 10.17].zip

Comments

  • kuronekokuroneko Posts: 3,623
    edited 2011-11-13 16:42
    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.
  • benoit2010benoit2010 Posts: 2
    edited 2011-11-13 18:07
    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.
  • kuronekokuroneko Posts: 3,623
    edited 2011-11-13 18:30
    benoit2010 wrote: »
    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.
Sign In or Register to comment.