Shop OBEX P1 Docs P2 Docs Learn Events
Hour Meter from Proto-USB right out of the box — Parallax Forums

Hour Meter from Proto-USB right out of the box

TappermanTapperman Posts: 319
edited 2014-10-03 22:09 in Propeller 1
Here is a piece of code I wrote just for the USB ver ... which, now is no good.

... Tim

Comments

  • PublisonPublison Posts: 12,366
    edited 2014-09-24 13:14
    Tapperman wrote: »
    Here is a piece of code I wrote just for the USB ver ... which, now is no good.

    ... Tim

    Tim,

    I'm confused. Will it not work with other boards?

    I can't find Proto_IO.spin but we can change it to accommodate any board.
  • TappermanTapperman Posts: 319
    edited 2014-09-24 13:15
    Publison wrote: »
    Tim,

    I'm confused. Will it not work with other boards?


    Maybe ... but, I don't have the one of the others ... someone who does could tell me?

    ... Tim
  • Duane DegnDuane Degn Posts: 10,588
    edited 2014-09-24 13:21
    Tapperman wrote: »
    Maybe ... but, I don't have the one of the others ... someone who does could tell me?

    ... Tim

    I can't imagine why it wouldn't work with other boards. What aspect of the program are you concerned about?
  • Bill HenningBill Henning Posts: 6,445
    edited 2014-09-24 13:24
    Huh?

    Just substitute any USB/Serial converter and use a different board.
    Tapperman wrote: »
    Here is a piece of code I wrote just for the USB ver ... which, now is no good.

    ... Tim
  • Dave HeinDave Hein Posts: 6,347
    edited 2014-09-24 13:43
    It looks like the program writes to EEPROM 14,400 times per day. It seems like this would wear out the EEPROM after a couple of months.
  • TappermanTapperman Posts: 319
    edited 2014-09-24 14:02
    Dave Hein wrote: »
    It looks like the program writes to EEPROM 14,400 times per day. It seems like this would wear out the EEPROM after a couple of months.

    Yeah, but it doesn't stay on all the time ... here I get the power from the space heater coil for my van warmer ... typical use over night in cold weather is less than 2 hours total.

    .... Tim

    PS - Would you really put an hour meter on a load that ran 24/7? Or, write down on your calendar when you powered the load up? Sometimes the numbers we get off of a calculator are off ... not in the size of the tree, but the shape of the forest they reside in.
    1024 x 768 - 98K
  • PublisonPublison Posts: 12,366
    edited 2014-09-24 14:05
    Tapperman wrote: »
    Maybe ... but, I don't have the one of the others ... someone who does could tell me?

    ... Tim

    If you can post all your code, I'm sure we will make it work.
  • TappermanTapperman Posts: 319
    edited 2014-09-24 14:12
    Publison wrote: »
    If you can post all your code, I'm sure we will make it work.

    Oh yeah, always forget about archiving.

    ... Tim
  • GenetixGenetix Posts: 1,754
    edited 2014-09-24 20:47
    idbruce wrote: »
    All I can say about the current selection of available Propeller boards is that I am not interested in purchasing any of those products.

    Tell them what you want.
  • TappermanTapperman Posts: 319
    edited 2014-09-25 14:18
    Dave Hein wrote: »
    It looks like the program writes to EEPROM 14,400 times per day. It seems like this would wear out the EEPROM after a couple of months.

    Anyone have a suggestion for distributing the values stored in EEPROM ... so as to distribute the wear & tear evenly among the upper 32K in the Proto board? Although Dave's estimate is off ... He does have a valid point!

    What ever scheme is used ... It must be quick ... I have some starting ideas:

    1st, clear the entire upper 32K and write one cell at a time ... each bit would represent a tick in time. But this would write to the same address 32 times before moving on to the next memory locale. And, at start up the software would have to find the last locale very quickly ... perhaps binary search would be quick enough? In addition, error recovery would be impossible with this approach.

    2nd, clear the entire upper 32K and write the long value (of total 6 sec periods) in each set of 4 bytes. And, at start up, the software would have to find the last locale written to ... very quick. Error recovery would be possible with this scheme. Additionally, the total hours would be a function of the last valid value stored.

    ... Tim

    PS - Since this board is no longer available, this effort is a little bit like "painting the Titanic after it struck the ice burg."
  • idbruceidbruce Posts: 6,197
    edited 2014-09-25 16:08
    PS - Since this board is no longer available, this effort is a little bit like "painting the Titanic after it struck the ice burg."

    I am right there with you. I feel the pain.
  • edited 2014-09-27 12:32
    I created an hourmeter using a DS1302 and a backup battery. The code stores the pump run time ( hours, minutes and seconds ) in the clock ram which is maintained by the backup battery when main power is removed. This method does add extra components though.

    Haven't looked at your code but if you updated the EEPROM data every minute you would only have 1,400 updates per day.

    Sandy
  • TappermanTapperman Posts: 319
    edited 2014-09-27 16:17
    I created an hourmeter using a DS1302 and a backup battery. The code stores the pump run time ( hours, minutes and seconds ) in the clock ram which is maintained by the backup battery when main power is removed. This method does add extra components though.

    Haven't looked at your code but if you updated the EEPROM data every minute you would only have 1,400 updates per day.

    Sandy

    Yeah ... I have a PPDB w/a clock calendar unit on it as well (I think it uses the same chip) ... and could use same for app ... but, as I said earlier in another post ... who uses an hour meter for a load that runs 24/7? My hour meter is used for loads that are demand driven, and I have no real idea how long they will remain on ... sometimes less than one minute. So, an estimate of writes per day is difficult to evaluate using a calculator on your desktop. Also, a clock that updated once a minute would miss tallying the load current used, by a considerable amount.

    But, if I distribute the writes over many different memory locations ... the wear and tear would be even, correct? Or, am I missing something in my understanding of the EEPROM's wear with write function?

    Even for loads that stay on for 10 minutes (lets say) ... being off by one count, at your proposed update rate, can mean 10% uncertainty ... or there about. My original point was, this board could be used as a hour meter right out of the box w/no hardware added. Believe me ... I understand it is not perfect for every situation, but there are a few it can handle quite nicely.

    ... Tim

    PS - If you run your clock calendar chip with a battery backup ... it keeps tallying time even when the load is off, correct? You would have to write the calendar values somewhere that is not updated when the power is off. Say in the 31 user bytes it has.
  • edited 2014-09-28 18:19
    Tapperman wrote: »
    PS - If you run your clock calendar chip with a battery backup ... it keeps tallying time even when the load is off, correct? You would have to write the calendar values somewhere that is not updated when the power is off. Say in the 31 user bytes it has.

    My code; retrieves the stored time value ONCE at startup, increments the time value when the clock seconds change IF a specified pin is high, writes the time value to clock ram and waits for the second to change again. Basically I'm using the DS1302 as a time reference and a battery backed ram module. Makes it easy to zero the hourmeter if I want and I don't have to worry about memory wear. The DS1302 isn't very accurate unless you use a DS32kHz but it's accurate enough for what I'm doing with just the regular crystal.

    The code file is attached.

    Sandy
  • TappermanTapperman Posts: 319
    edited 2014-09-28 18:44
    The code stores the pump run time ( hours, minutes and seconds ) in the clock ram

    @Sandy, I see from your original post (I missed it the first time) that you did say exactly that. My Bad.

    ... Tim

    PS - Zero wear and tear using that configuration.
  • edited 2014-09-28 21:11
    The code file, objHourmeter v1.00.spin, is now attached to my [post=1295542]original message[/post]. This code comes with the usual world famous Frank Fink triple duece guarantee; 2 miles, 2 minutes or until it splits in half.

    Sandy
  • TappermanTapperman Posts: 319
    edited 2014-10-03 22:09
    Publison wrote: »
    If you can post all your code, I'm sure we will make it work.

    It works already ... I'm kind of curious to see if it works on other proto boards? And since I have no other proto board ... Other than a USB proto board ... I do not know the answer to this question? I need a volunteer.

    ... Tim
Sign In or Register to comment.