Storing hours and minutes into single byte?


Results 1 to 17 of 17

Threaded View

  1. #11
    Join Date
    Apr 2011
    Location
    Welches, Oregon
    Posts
    198


    Did you find this post helpful? Yes | No

    Default Re: Storing hours and minutes into single byte?

    Quote Originally Posted by Charlie View Post
    There are 1440 minutes in a day that need to be uniquely identified somehow.
    Since you require 1440 "symbols" you will need at least 11 bits.
    If you want to use different memory locations, you would need 6 (8 bit) locations.
    Reducing the accuracy? Sampling every 5 minutes won't cut it - you will need to go to 6 minute samples to fit in a byte.
    Coding time in the smallest possible binary space is a problem that has been around for at least 70 years now - likely nobody has thought about it before
    One wonders how you know that all 1440 "symbols" need be uniquely identified. The Op didn't say so. In fact, if all 1440 symbols were needed, then he would likely make a 1 minute interrupt and save all the speculation. Nor do I full understand why 6 minute samples are needed? There are 12 five minute segments in an hour; if it possible to represent the 12 hour positions in 4 bits, why can not the 12 five minute positions be represented similarly (in four bits)? Lastly, I would respectfully suggest that the OP already has a clock, he is looking to record some finite number of unique data points, not serial time at all.

    Here is an example of my thinking: Suppose the OP would be satisfied to record 5 points per hour in 128 bytes. He might record any 10 minute readings (5 AM, 5 PM or any combination) between memory positions 00 and 10. All of these bytes are presumed to be in the hour between 12:00 (zero hour) and 1:00; similarly, between address 11 and 20 are the data points corresponding to the hour between 1:00 and 2:00 - and so forth. In this way he might record 120 unique time stamps in 120 bytes -and include an AM/PM flag in one of the remaining two bits. Adequate? I don't know... Only one thought that might spur others.
    Last edited by Amoque; - 5th June 2014 at 04:01. Reason: Typo

Similar Threads

  1. SEROUT command (single byte value not string)
    By MrRoboto in forum mel PIC BASIC
    Replies: 15
    Last Post: - 12th June 2010, 03:34
  2. 6 hours for a comma, a space, and some caps.....
    By boroko in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 13th March 2009, 20:31
  3. 10,20,30,40 minutes
    By helena in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 1st March 2007, 12:04
  4. Timer and long (hours) sleep period - how to?
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 8th January 2007, 07:32
  5. increases every 5 minutes
    By Sasha in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 22nd April 2006, 21:09

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts