Working out hours and minutes from a word variable


Closed Thread
Results 1 to 6 of 6

Hybrid View

  1. #1
    Join Date
    Jan 2013
    Location
    Texas USA
    Posts
    229


    Did you find this post helpful? Yes | No

    Default Re: Working out hours and minutes from a word variable

    Scampy,

    Use the regular Division "/" operator for the Hours computation and use the Modulo "//" operator for the minutes computation.

    lightsetHR1 = (CH1_on_time / 60)
    lightsetMN1 = (CH1_on_time // 60)




    Cheers,
    Regards,
    TABSoft

  2. #2
    Join Date
    Oct 2005
    Posts
    18


    Did you find this post helpful? Yes | No

    Default Re: Working out hours and minutes from a word variable

    Hi
    My mistake
    the line lightsetHR1=lightsetHR1/60 ' you get the integer part your example =14
    should be lightsetHR1=CH1_on_time/60 ' you get the integer part your example =14
    then it produces the same results with the more elegant way that Tabsoft suggests.
    But I think that we should have used another new variable instead of CH1_on_time lets say Time_read_from_timer
    Then either way once you get the time from DS1307 you can split it into hours and minutes and then go on displaying it.
    Bill

  3. #3
    Join Date
    Oct 2009
    Posts
    583


    Did you find this post helpful? Yes | No

    Default Re: Working out hours and minutes from a word variable

    Thanks for the replies. If I get stuck I'll be back

Similar Threads

  1. Help with word variable
    By Scampy in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 26th November 2015, 12:16
  2. Storing hours and minutes into single byte?
    By CuriousOne in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 5th June 2014, 12:28
  3. Word Variable and I2C
    By Scampy in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 21st May 2014, 08:45
  4. Stumped with word variable
    By Scampy in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 11th November 2013, 13:11
  5. word variable to 25lc640
    By TONIGALEA in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 6th July 2004, 19:59

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