Hour Meter from Proto-USB right out of the box
Tapperman
Posts: 319
Here is a piece of code I wrote just for the USB ver ... which, now is no good.
... Tim
... Tim
Comments
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.
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?
Just substitute any USB/Serial converter and use a different board.
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.
If you can post all your code, I'm sure we will make it work.
Oh yeah, always forget about archiving.
... Tim
Tell them what you want.
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."
I am right there with you. I feel the pain.
http://www.frys.com/product/7580616?source=google&gclid=CjwKEAjw-o6hBRDOmsPSjqakuzYSJADR2V3S8epZ7zHqPGvZ62_ELtdBCHsmvOvlMISV3UnuJ_PdWRoCFz_w_wcB
http://www.makershed.com/products/propeller-proto-board-usb?gclid=CjwKEAjw-o6hBRDOmsPSjqakuzYSJADR2V3S6446Tl7mnxwJ6RzushnU7A6w4bnc6yJnITW_HJxakhoCf1Pw_wcB
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.
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
@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.
Sandy
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