Menu

Digital Speedo Idea's

Help
lpme126
2008-06-27
2013-05-30
  • lpme126

    lpme126 - 2008-06-27

    Hello all, and thank you in advance for any help offered.
    I'm wanting to develop a simple digital speedometer readout on an LCD which should be pretty easy but I'm not sure of 2 things.

    What is the best way of implementing a simple frequency counter with a range of say 0 - 5khz. Using timers? is so which one and what is the best way. I know I'll have to calibrate the output by storing a value in EEprom to convert Hz to Kilometers per hour, but as I said is using the timer between pulses the way to go?

    Also I want to have an odometer as well, but how to I get it to count & store in eeprom over 65025?

    Any idea's much appreciated

    Best Regards

    Paul

     
    • kent_twt4

      kent_twt4 - 2008-06-28

      There was a recent post on CCP1, which looks very interesting for your application.  The capture part of CCP1 keeps a copy of TIMR1.  With the use of an interrupt service routine, and TIMR1, you keep track of the interrupts/CCP1IF flags (i.e. low to high and high to low edges), to measure a revolution.

      As far as the odometer EEProm situation, keep track of the overflow with a conditional statement and send that value to an extra EEPRom address.  I think the trick here would be to create some constants by using the compiler/#script command based on the extra byte value.  So for example, in pseudo code, calculating an odometer number of 955,000:

      Extrabyte = 14

      'compiler script constants for Extrabyte14:
      ExtraWord14 = (14x65536)/100 = 9175
      ExtraRemain14 = 4

      'Simler calcs using GCBasic  on lower word;
      Wordvalue = Wordvalue/100 = 374
      ByteRemain = Wordvalue % 100 = 96

      'print out on lcd
      Use math and conditional statements as appropriate to display decimal place holders Wordvalue + ExtraWord14, and ByteRemain + ExtraRemain14.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.