Storing hours and minutes into single byte?


Closed Thread
Results 1 to 17 of 17

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default Re: Storing hours and minutes into single byte?

    How about 60x24=1440 8 bits is 256 save time as 6 min chuncks 1440/6=240

    for example

    01:08 = 1x60/6 + 8/6 = 11 (time somewhere between 01:06 and 01:11)

    23:59 = 23x60/6 + 59/6 = 239 (time somewhere between 23:55 and 24:00)


    Clunky but it works provided you don't need better resolution.

    George
    Last edited by towlerg; - 4th June 2014 at 15:45.

  2. #2
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default Re: Storing hours and minutes into single byte?

    You could use a word for HHMM, but nothing is stopping you from sharing some of the unused bits for other data.

    Robert

  3. #3
    Join Date
    Feb 2013
    Posts
    1,153


    Did you find this post helpful? Yes | No

    Default Re: Storing hours and minutes into single byte?

    Differentiation between 11:14 and 14:11 will be quite easy, because when time from RTC reaches that time, a variable is toggled, which can be later used to determine exactly what time should be read now.

  4. #4
    Join Date
    Feb 2011
    Posts
    60


    Did you find this post helpful? Yes | No

    Default Re: Storing hours and minutes into single byte?

    If you can live with 2 second resolution then there are 43200 2-seconds per day -- one word.

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