Shop OBEX P1 Docs P2 Docs Learn Events
BS2 Speedometer & Odometer. — Parallax Forums

BS2 Speedometer & Odometer.

jknightandkarrjknightandkarr Posts: 234
edited 2009-07-20 20:54 in BASIC Stamp
I'm not having much luck here. I'm using my BS2 homework board to design a speedometer using an instrument cluster from an 87 Firebird to calibrate & the cars vehical speed sensor & the VSS Buffer to operate the stock cluster & send a signal to the BS2. Now the problem is I got the BS2 acting as a speedometer using the Debug command to send it to the pc moniter for now, and according to my stock gauge my cordless drill runs the speedometer up to about 78-78.5 Mph, & the BS2 reads like 84 MPH

Here's my speedometer program

' {$STAMP BS2}
' {$PBASIC 2.5}

Pulse PIN 15
vss VAR Word
Mph VAR Word

DO

COUNT Pulse, 1000, vss
Mph=vss
DEBUG HOME, " MPH = ", DEC Mph

LOOP

Now since my stock instrument cluster is analog, I'm not sure if it's correct or off or what, and I have no other way to calibrate my speedometer program if its off or to tell if it's off. I also need to build an odometer using a 000,000.0 format and unless my stock cluster is correct, I can't calibrate my odometer either, nor do I have an idea how I need to code my program to opperate as a odometer as well. I'll probly use driver chips to operate the 7-segment displays. I'm still learning about the BS2 & programing it. Please help.

Joe

Post Edited (jknightandkarr) : 6/22/2009 6:41:33 PM GMT
«1

Comments

  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2009-06-22 21:33
    jknightandkarr

    You might try this and see if this changes your value on the BS2 Output

    COUNT Pulse, 1000, vss·· to· ·COUNT Pulse, 995, vss ·or COUNT Pluse 1005,·vss

    This could be a timing problem in that how long dose it take to run your routine that·you are using

    This is only a guess in that I have not use the COUNT Command before and you may have try this alreaady if that is the case

    You do not need vss· and MPH if they are going to be the same value



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ··Thanks for any·idea.gif·that you may have and all of your time finding them smile.gif

    ·
    ·
    ·
    ·
    Sam
  • jknightandkarrjknightandkarr Posts: 234
    edited 2009-06-22 21:42
    What I ment by calibrating isn't quite on the BS2 end, but rather on my stock instrument cluster end, I have no idea if its correct or off. Well as for the vss & MPH was left from a previous attempt, never removed one or the other, figured trying to use one for the odometer in needed. Any ideas on designing an odometer? I started messing with it but am stumped. I have no idea what to do to take the odometer & start at 0.0 & count up, if I use the speedometer to start with & just odometer=MPH+1, that won't work. I know I'll probly need an external EEPROM to store the milage info since the BS2 won't support much over 65K.

    Joe

    Post Edited (jknightandkarr) : 6/22/2009 9:53:37 PM GMT
  • ercoerco Posts: 20,256
    edited 2009-06-22 21:57
    For your odometer, you can write the newly incremented mileage value to the Stamp's EEPROM at powerdown and read it back from EEPROM at startup. Works like a charm, but do be aware that each EEPROM location is only good for a million or so read/write cycles (electrical wear & tear!), so don't let your software get into an endless loop of writing & reading instructions or you may burn out that single location. Of course, you'll have 2000+ other EEPROM locations to try...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
  • Larry~Larry~ Posts: 242
    edited 2009-06-23 00:28
    You are reading RPM not MPH the calibration is in the pulses per mile so you just can't take the pulses and make it miles Per Hour there will be math involved. your drill is 5340 RPM ?



    Some cars use 2000 PP Mile and some use 4000 PP Mile GM and there are many different setups
    So this is what I see for a 4000 Pulses per Mile
    90mph = 6000pulses per minute = 100pulese per second
    60mph = 4000ppm = 66.66pps
    30mph = 2000ppm = 33.33pps
    15mph = 1000ppm = 16.66pps
    Your reading of 89pps works out to 80.1 mph
    Guess I should add that 90 mph / 6000 pp minute = .015 also 15mph / 1000pp minute =.015
    So your pulses 89 times 60 seconds = 5340rpm·Times .015 = 80.1 mph






    Post Edited (L_Gaminde) : 6/23/2009 12:44:31 AM GMT
  • Larry~Larry~ Posts: 242
    edited 2009-06-23 01:03
    Try this loop and see if it works out

    DO

    COUNT Pulse, 1000, vss
    Mph = vss * 9
    DEBUG HOME, " MPH = ", DEC Mph DIG 2, DEC Mph DIG 1

    LOOP
  • jknightandkarrjknightandkarr Posts: 234
    edited 2009-06-23 02:15
    L_Gaminde said...
    You are reading RPM not MPH the calibration is in the pulses per mile so you just can't take the pulses and make it miles Per Hour there will be math involved. your drill is 5340 RPM ?



    <SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 10pt">Some cars use 2000 PP Mile and some use 4000 PP Mile GM and there are many different setups<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com[noparse]:office:[/noparse]office" /><otongue.gif></otongue.gif>

    <SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 10pt">So this is what I see for a 4000 Pulses per Mile <otongue.gif></otongue.gif>

    <SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 10pt">90mph = 6000pulses per minute = 100pulese per second<otongue.gif></otongue.gif>

    <SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 10pt">60mph = 4000ppm = 66.66pps<otongue.gif></otongue.gif>

    <SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 10pt">30mph = 2000ppm = 33.33pps<otongue.gif></otongue.gif>

    <SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 10pt">15mph = 1000ppm = 16.66pps<otongue.gif></otongue.gif>

    <SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 10pt">Your reading of 89pps works out to 80.1 mph<otongue.gif></otongue.gif>

    <SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 10pt">Guess I should add that 90 mph / 6000 pp minute = .015 also 15mph / 1000pp minute =.015<otongue.gif></otongue.gif>

    <SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 10pt">So your pulses 89 times 60 seconds = 5340rpm Times .015 = 80.1 mph<otongue.gif></otongue.gif>

    I'll take the suggestions into suggestion. Thanks. As for reading the rpms on the drill? I have no idea. but I have an electric Firebird speedometer cluster hooked up at the same time as the BS2 as a test bench, so I'm not too far off. The stock speedo is reading about 78 mph to the BS2's 84 They are close to matching. But I'm not spot on the dot, but if your way gets it there I'll try it. Thanks.

    Joe
  • jknightandkarrjknightandkarr Posts: 234
    edited 2009-06-23 02:21
    L_Gaminde said...
    Try this loop and see if it works out

    DO

    COUNT Pulse, 1000, vss
    Mph = vss * 9
    DEBUG HOME, " MPH = ", DEC Mph DIG 2, DEC Mph DIG 1

    LOOP

    Tried this, now matching against my Firebird cluster I'm now reading 78 Mph against the Firebirds 80 Mph I'll keep playing with that though. Thanks.

    Joe

    Post Edited (jknightandkarr) : 6/23/2009 2:37:52 AM GMT
  • Larry~Larry~ Posts: 242
    edited 2009-06-23 04:05
    read the nameplate on the drill it will give you the speed !
    also if it has two speeds put it on low and give it another try
    you can have two debugs one with vss the other with mph to compare
  • jknightandkarrjknightandkarr Posts: 234
    edited 2009-06-23 04:42
    I think the drill is 400 on low gear, 1400 on high gear. I knew what the speed of the drill was, I should have said what I really ment, sorry. What I ment was I don't see what you ment by I was reading the drills rpms not Mph.

    Joe
  • Larry~Larry~ Posts: 242
    edited 2009-06-23 15:29
    Ok lets start over I missed some info. You have pulled out a VSS, a VSS Buffer unit and an instrument cluster from a 87 firebird you are turning the VSS with a drill and using the·VSS buffer·output wire to·feed the instrument cluster and the BS2. Everything is electronic, is this correct so far?

    How many pulses per mile is the·instrument cluster rated at ?· this is your calibration !

    Lets get this working first correctly then we can move on to Odometer or both will be wrong.
    jknightandkarr said...
    I'm not having much luck here. I'm using my BS2 homework board to design a speedometer using an instrument cluster from an 87 Firebird to calibrate & the cars vehical speed sensor & the VSS Buffer to operate the stock cluster & send a signal to the BS2. Now the problem is I got the BS2 acting as a speedometer using the Debug command to send it to the pc moniter for now, and according to my stock gauge my cordless drill runs the speedometer up to about 78-78.5 Mph, & the BS2 reads like 84 MPH

    Here's my speedometer program

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}

    Pulse PIN 15
    vss VAR Word
    Mph VAR Word

    DO

    COUNT Pulse, 1000, vss
    Mph=vss
    DEBUG HOME, " MPH = ", DEC Mph

    LOOP

    Now since my stock instrument cluster is analog, I'm not sure if it's correct or off or what, and I have no other way to calibrate my speedometer program if its off or to tell if it's off. I also need to build an odometer using a 000,000.0 format and unless my stock cluster is correct, I can't calibrate my odometer either, nor do I have an idea how I need to code my program to opperate as a odometer as well. I'll probly use driver chips to operate the 7-segment displays. I'm still learning about the BS2 & programing it. Please help.

    Joe
  • Larry~Larry~ Posts: 242
    edited 2009-06-23 15:44
    I don't have a manual handy but something else you can do Is pulse the stamp @ 4000 pulses per minute and take this output to the instrument cluster and see if it puts out 60mph
  • jknightandkarrjknightandkarr Posts: 234
    edited 2009-06-23 16:27
    L_Gaminde said...
    Ok lets start over I missed some info. You have pulled out a VSS, a VSS Buffer unit and an instrument cluster from a 87 firebird you are turning the VSS with a drill and using the VSS buffer output wire to feed the instrument cluster and the BS2. Everything is electronic, is this correct so far?

    How many pulses per mile is the instrument cluster rated at ? this is your calibration !

    Lets get this working first correctly then we can move on to Odometer or both will be wrong.

    I have an 89 factory Pontiac Firebird dealer manual for my 89 Trans-Am, & It says under the VSS section of the electronics scematics section of book 4000 ppm to the cluster.

    You got it exactly now, I am just using my drill to spin the vss, which then sends the signal to the factory cluster from the buffer. I got my cluster, buffer & now even my BS2 all powered from an old 486 computer swichable power supply, which supplies me about 9.8 VDC. I'll try your suggestion of using the BS2 to send a signal to my cluster to get a reading. I tried it before but it didn't work. Maybe it will now since the BS2 & the cluster are both working off the same power supply.

    Joe
  • jknightandkarrjknightandkarr Posts: 234
    edited 2009-06-23 16:53
    Ok I got the BS2 to send a signal to the cluster, since both powered from the same source, it worked, First I tried PULSOUT 15, 213 which gave a reading at first, but the reading on the speedo would increase gradually, so I used FREQOUT 15, 5000, 63 which gave me a steady 60 on the speedo

    Joe
  • Larry~Larry~ Posts: 242
    edited 2009-06-23 19:22
    Where did you come up with 63 on freqout, it looks like 66.66 is what you need so 66 or 67 should be correct, and that means the cluster is off a little. So try 66 and 67 and lets see what you get
  • Larry~Larry~ Posts: 242
    edited 2009-06-23 19:42
    66 should give you about 62.857 mph
    67 should give you about 63.809 mph

    the reading should be 60 mph so the cluster is fast by about 3 mph ?

    so looking back at the program

    DO

    COUNT Pulse, 1000, vss
    Mph = vss * 9
    DEBUG HOME, " MPH = ", DEC Mph DIG 2, DEC Mph DIG 1

    LOOP

    and it was 2 mph slower than the cluster it looks to be dead on !!!
  • jknightandkarrjknightandkarr Posts: 234
    edited 2009-06-24 01:41
    I figured 66 2/3 myself, so I tried both 66 & 67 on FREQOUT with 66 & got 63 Mph & on FREQOUT with 67 I got 64 Mph, so looks like the cluster is indeed fast by about 3-4 Mph
    well after playing around with the speedometer's needle at a FREQOUT 15, 5000, 67 The speedometer now reads 60 Mph which is only 20 pulses per mile off which is hardly anything. I thank you for help making my speedometer part of my test bench accurate! Now for the odometer program & then getting my test bench tach to work. lol

    Joe
  • mrsnowmanmrsnowman Posts: 4
    edited 2009-06-24 15:53
    One thing to consider is you only need to update the DEBUG at a rate the human can see a change. You might consider collecting your information at high speeds and only displaying the data at human speeds by skipping the display 4 out of 5 times. or display it if it changes or a certain amount of time passes.
  • Larry~Larry~ Posts: 242
    edited 2009-06-24 16:45
    Odometer stuff
    I used four seperate 1 byte varables for my odometer this was done on a pic chip.

    ODOM0 VAR BYTE 'MILES 10000 TO 990000
    ODOM1 VAR BYTE 'MILES 100 TO 9900
    ODOM2 VAR BYTE 'MILES 1 TO 99
    ODOM3 VAR BYTE 'MILES .1 TO .9

    miles = vss + miles 'This adds up the pulses after each spedo read
    if miles = 400 goto odom3 'This checks for 400 ppm and adds one to the tenths place

    now you just add one to each varable as the one below it rolls over odom3 then odom2 then odom1 then odom0
  • jknightandkarrjknightandkarr Posts: 234
    edited 2009-06-24 20:01
    L_Gaminde said...
    Odometer stuff
    I used four seperate 1 byte varables for my odometer this was done on a pic chip.

    ODOM0 VAR BYTE 'MILES 10000 TO 990000
    ODOM1 VAR BYTE 'MILES 100 TO 9900
    ODOM2 VAR BYTE 'MILES 1 TO 99
    ODOM3 VAR BYTE 'MILES .1 TO .9

    miles = vss + miles 'This adds up the pulses after each spedo read
    if miles = 400 goto odom3 'This checks for 400 ppm and adds one to the tenths place

    now you just add one to each varable as the one below it rolls over odom3 then odom2 then odom1 then odom0


    Well I added this to my speedo code as well as the variable data, howver for some reason, odom3 isn't getting any changes.

    DEBUG " Odometer = ", DEC odom3 DIG 1, CR
    DEBUG " Miles = ", DEC miles DIG 3, DEC miles DIG 2, DEC miles DIG 1, CR

    miles=vss+miles
    IF (miles=400) THEN
    odom3=odom3+1

    ENDIF

    LOOP

    I tried several variations of the odometer program. Nothing advances odom3. What am I going wrong? Do I need to make each odom# a separate program off of the main one?

    Joe
  • Larry~Larry~ Posts: 242
    edited 2009-06-24 21:07
    Correction made·4 so far

    DO

    COUNT Pulse, 1000, vss
    Mph = vss * 9
    DEBUG HOME, " MPH = ", DEC Mph DIG 2, DEC Mph DIG 1
    vss1 = vss + vss1······················································· ·: Keeps tabs on all pulses,··· VSS1 needs to be saved to eprom
    IF (vss1 => 400) THEN gosub odom10th·························· : Keeps looking at pulses until you have reached 400 or more
    LOOP

    odom10th:
    vss1=vss1-400····························································: Takes away 400 pulses for 1 tenth, Saves overflow in·VSS1
    odom3=odom3+1··························································: This is your tenths,··· needs to be saved to eprom··
    if odom3 = 10 then gosub odom_one······························· : Check if tenths = 10 if so goto miles and add one to the miles
    return

    and just keep going


    Post Edited (L_Gaminde) : 6/27/2009 6:38:26 PM GMT
  • Larry~Larry~ Posts: 242
    edited 2009-06-24 22:57
    jknightandkarr said...
    I figured 66 2/3 myself, so I tried both 66 & 67 on FREQOUT with 66 & got 63 Mph & on FREQOUT with 67 I got 64 Mph, so looks like the cluster is indeed fast by about 3-4 Mph
    well after playing around with the speedometer's needle at a FREQOUT 15, 5000, 67 The speedometer now reads 60 Mph which is only 20 pulses per mile off which is hardly anything. I thank you for help making my speedometer part of my test bench accurate! Now for the odometer program & then getting my test bench tach to work. lol

    Joe
    5280·feet per mile / 4000 pulses per mile = 1.32 feet per pulse
    66.66 what you need 67 what you set it for, your only off .34 pulses
    .34 pulses x 1.32 feet per pulse =·.4488 feet off or 5.3856 inches per mile
    it will take 11,764.7 miles to be off by one mile yea thats close enough
  • Larry~Larry~ Posts: 242
    edited 2009-06-26 15:06
    I hope no one read this, cause I was wrong

    you will be off 1 mile every 3105.88 miles

    I think it needs fixin!

    should have been .34 x 60 x 1.32 = 20.4" per mile
    L_Gaminde said...
    jknightandkarr said...
    I figured 66 2/3 myself, so I tried both 66 & 67 on FREQOUT with 66 & got 63 Mph & on FREQOUT with 67 I got 64 Mph, so looks like the cluster is indeed fast by about 3-4 Mph
    well after playing around with the speedometer's needle at a FREQOUT 15, 5000, 67 The speedometer now reads 60 Mph which is only 20 pulses per mile off which is hardly anything. I thank you for help making my speedometer part of my test bench accurate! Now for the odometer program & then getting my test bench tach to work. lol

    Joe
    5280·feet per mile / 4000 pulses per mile = 1.32 feet per pulse
    66.66 what you need 67 what you set it for, your only off .34 pulses
    .34 pulses x 1.32 feet per pulse =·.4488 feet off or 5.3856 inches per mile
    it will take 11,764.7 miles to be off by one mile yea thats close enough
  • jknightandkarrjknightandkarr Posts: 234
    edited 2009-06-27 02:57
    L_Gaminde said...
    I hope no one read this, cause I was wrong

    you will be off 1 mile every 3105.88 miles

    I think it needs fixin!

    should have been .34 x 60 x 1.32 = 20.4" per mile

    I'm not sure where the 67 & 66 2/3 comes in, but advancing the odom3 by 1 every 400 pulses will be what I need to use since 4,000/10=400 & 60 mph=1 mile per min=.1 miles per 6 seconds. I used the 67 on the FREQOUT command to generate 67 pulses per sec to calibrate my factoy speedometer cluster. I wasn't using it on my odometer to design it or calibrate it.

    Joe
  • Larry~Larry~ Posts: 242
    edited 2009-06-27 18:17
    Have you done any more on the Odom ? did you try the code I Posted and reposted 3 times (mistakes) ?
    just curious to see if you made it work.
  • jknightandkarrjknightandkarr Posts: 234
    edited 2009-06-28 03:18
    I tried it last night, looks like I got a bug to work out, odom3 seams to advance before I get to 400 on my miles variable.

    Joe
  • Larry~Larry~ Posts: 242
    edited 2009-06-28 16:31
    Try this I ran a test with this using vss = 67
    see if this runs using a drill

    ' {$STAMP BS2}
    ·vss VAR Word
    ·vss1 VAR Word
    ·Mph VAR Word
    ·odom3 VAR Word

    start:
    COUNT pulse, 1000, vss
    'vss = 67
    Mph = vss * 9
    DEBUG HOME, " MPH = ", DEC Mph DIG 2, DEC Mph DIG 1,CR
    DEBUG "ODOM = ","000,000,",DEC odom3, CR
    vss1 = vss + vss1
    IF vss1 >= 400 THEN odom10th······ ' Keeps tabs on all pulses,··· VSS1 needs TO be saved TO eprom
    GOTO start························ ' Keeps looking at pulses until you have reached 400 OR more

    odom10th:
    vss1=vss1 - 400··················· ' Takes away 400 pulses FOR 1 tenth, Saves overflow in VSS1
    odom3 = odom3+1··················· ' This is your tenths,··· needs TO be saved TO eprom
    IF odom3 = 10 THEN· odom_one······ ' Check IF tenths = 10 IF so GOTO miles AND add one TO the miles
    GOTO start

    odom_one
    DEBUG "done reading"
  • Larry~Larry~ Posts: 242
    edited 2009-06-28 16:46
    This is how I ran it in test mode, without using pulses.· I forgot to define pulses in the first program!

    ' {$STAMP BS2}
    ·vss VAR Word
    ·vss1 VAR Word
    ·Mph VAR Word
    ·odom3 VAR Word

    start:
    COUNT 1, 1000, vss
    vss = 67
    Mph = vss * 9
    DEBUG HOME, " MPH = ", DEC Mph DIG 3,DEC Mph DIG 2, DEC Mph DIG 1,CR
    DEBUG "ODOM = ","000,000,",DEC odom3, CR
    vss1 = vss + vss1
    IF vss1 >= 400 THEN odom10th······ ' Keeps tabs on all pulses,··· VSS1 needs TO be saved TO eprom
    GOTO start························ ' Keeps looking at pulses until you have reached 400 OR more

    odom10th:
    vss1=vss1 - 400··················· ' Takes away 400 pulses FOR 1 tenth, Saves overflow in VSS1
    odom3 = odom3+1··················· ' This is your tenths,··· needs TO be saved TO eprom
    IF odom3 = 10 THEN· odom_one······ ' Check IF tenths = 10 IF so GOTO miles AND add one TO the miles
    GOTO start

    odom_one
    DEBUG "done reading"
  • Larry~Larry~ Posts: 242
    edited 2009-06-28 18:36
    Updated test program runs on Bs2 with no inputs / outputs

    ' {$STAMP BS2}
    · vss VAR Word
    · vss1 VAR Word
    · Mph VAR Word
    · odom10 VAR Byte
    · odom1· VAR Byte


    start:
    COUNT 1, 1000, vss
    vss = 67
    Mph = vss * 9
    vss1 = vss + vss1················· ' Keeps tabs on all pulses,··· VSS1 needs TO be saved TO eprom
    DEBUG HOME, " MPH = ", DEC Mph DIG 3,DEC Mph DIG 2, DEC Mph DIG 1,CR
    DEBUG "ODOM = ","000","/","0",DEC odom1 DIG 1, DEC odom1 DIG 0,"/" ,DEC odom10, CR
    IF vss1 >= 400 THEN odom10th
    GOTO start························ ' Keeps looking at pulses until you have reached 400 OR more

    odom10th:
    vss1=vss1 - 400··················· ' Takes away 400 pulses FOR 1 tenth, Saves overflow in VSS1
    odom10 = odom10+1················· ' This is your tenths,··· needs TO be saved TO eprom
    IF odom10 = 10 THEN· odom_one····· ' Check IF tenths = 10 IF so GOTO miles AND add one TO the miles
    GOTO start

    odom_one:
    odom10 = 0
    odom1 = odom1 +1
    IF odom1 = 100 THEN odom100
    GOTO start

    odom100:
    DEBUG "done reading"
  • jknightandkarrjknightandkarr Posts: 234
    edited 2009-07-02 21:28
    Alright, I'll try that. Thanks.

    Joe
  • jknightandkarrjknightandkarr Posts: 234
    edited 2009-07-18 05:25
    Larry~ said...
    Updated test program runs on Bs2 with no inputs / outputs

    ' {$STAMP BS2}
    vss VAR Word
    vss1 VAR Word
    Mph VAR Word
    odom10 VAR Byte
    odom1 VAR Byte


    start:
    COUNT 1, 1000, vss
    vss = 67
    Mph = vss * 9
    vss1 = vss + vss1 ' Keeps tabs on all pulses, VSS1 needs TO be saved TO eprom
    DEBUG HOME, " MPH = ", DEC Mph DIG 3,DEC Mph DIG 2, DEC Mph DIG 1,CR
    DEBUG "ODOM = ","000","/","0",DEC odom1 DIG 1, DEC odom1 DIG 0,"/" ,DEC odom10, CR
    IF vss1 >= 400 THEN odom10th
    GOTO start ' Keeps looking at pulses until you have reached 400 OR more

    odom10th:
    vss1=vss1 - 400 ' Takes away 400 pulses FOR 1 tenth, Saves overflow in VSS1
    odom10 = odom10+1 ' This is your tenths, needs TO be saved TO eprom
    IF odom10 = 10 THEN odom_one ' Check IF tenths = 10 IF so GOTO miles AND add one TO the miles
    GOTO start

    odom_one:
    odom10 = 0
    odom1 = odom1 +1
    IF odom1 = 100 THEN odom100
    GOTO start

    odom100:
    DEBUG "done reading"

    I finally tried it, took some time away from my electronics, I needed it. Works great, to use my test bench just remove the "vss=67" line then add the odom100 subprog & odom2 as a var & export the digits to 7 seg displays as well as a couple other minor things.

    now the last sub prog should be something like
    odom100:
    odom_one = 0
    odom2 = odom2 +1
    IF odom2 = 1000 THEN odom2 = 0 'This line may or may not be needed'
    GOTO start

    Now I need to export the following variables to eeprom, odom10, odom1 & odom 2, correct? How is this done? I'd add an external eeprom to avoid using the BS2's eeprom & risk wearing that out by storing the odometers variables.

    I really appreaciate your help Larry~. Thanks to your last program I see why I had problems with mine. I should have left out the ( ) & should have left out GOSUB as well.

    Joe
Sign In or Register to comment.