touble with a time calculation


Results 1 to 40 of 59

Threaded View

  1. #17
    Join Date
    May 2013
    Location
    australia
    Posts
    2,644


    Did you find this post helpful? Yes | No

    Default Re: touble with a time calculation

    if you have a clock running
    try this
    h m s var bytes (current time )
    x y z var byte (old time )
    a b c var byte ( time difference)
    carry var bit

    time_difference: (assumes current time > old time)
    carry=0
    c=s-z
    if c>127 then
    c=c+60
    carry=1
    endif
    b=m-(y+carry)
    if b>127 then
    b=b+60
    carry=1
    else
    carry=0
    endif
    a=h-(x+carry)
    if a>127 then
    a=a+24
    carry=1 ;extra day needed to be added
    else
    carry=0
    endif
    return
    Last edited by richard; - 13th May 2014 at 14:04. Reason: typo needed brackets

Similar Threads

  1. Help with calculation
    By Megahertz in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 28th August 2012, 17:10
  2. CHECKSUM CALCULATION, Please Help!
    By wasilus in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 2nd August 2012, 07:55
  3. Calculation Problem - value goes to zero after 65
    By Tom Gonser in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 12th March 2010, 05:10
  4. calculation
    By lerameur in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 20th May 2008, 16:28
  5. CRC Calculation - Need a little help
    By Steve43 in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 13th March 2005, 01:23

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