touble with a time calculation


Closed Thread
Results 1 to 40 of 59

Hybrid View

  1. #1
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    838


    Did you find this post helpful? Yes | No

    Default Re: touble with a time calculation

    in fact i have several clock timers running for this project , most are based on the master timer with other value settings to change the displayed results

    for this task the time counter counts up from 0 , the set _time value is the length of time before trigging the overtime clock , which counts up to show the total amount of time exceeding the set_time values

    when the main timer exceeds the set_time then a secondary timer ( overtime clock ) is enabled and then shows and continues to run until the main timer stops

    as seen if the overtime clock values = main clock - set time , when a sec , min , hour roles over , a < 0 value will occur untill the time value = set_time value again

  2. #2
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333


    Did you find this post helpful? Yes | No

    Default Re: touble with a time calculation

    Quote Originally Posted by longpole001 View Post
    as seen if the overtime clock values = main clock - set time , when a sec , min , hour roles over , a < 0 value will occur untill the time value = set_time value again
    Yes that is exactly what your code does. I did wonder if that was what you wanted to do.

    I was also thinking if this is necessary

    if Days => Set_Day and Hours => Set_Hour and _
    Minutes => Set_Min and Seconds => Set_Sec and _
    100th => Set_100th then OT_Enable = 1

    and what would be the implications of just having this

    OT_Days = Days - Set_Day
    OT_Hours = Hours - Set_Hour
    OT_Minutes = Minutes - Set_Min
    OT_Seconds =Seconds - Set_sec
    OT_100th = 100TH - Set_100th



    if Hours - Set_Hour <0 then
    OT_Days = Days - 1
    OT_Hours = 23 - Set_Day + Hours
    endif

    if Minutes - Set_Min <0 then
    OT_Hours = OT_Hours - 1
    OT_Minutes = 59 - Set_Min + Minutes
    endif

    if Seconds - Set_Sec <0 then
    OT_Minutes = OT_Minutes - 1
    OT_Seconds = 59 - Set_Sec + Seconds
    endif

    if 100TH - Set_100th <0 then
    OT_Seconds = OT_Seconds - 1
    Ot_100TH = 99 - Set_100th + 100TH
    endif

    Just a thought

  3. #3
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    838


    Did you find this post helpful? Yes | No

    Default Re: touble with a time calculation

    yes ill start on the space problem thread later this week ,
    can you PM me an example bit of code for the sd card , mainly how you append data to existing open file , indexed data reads example if you have it

  4. #4
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333


    Did you find this post helpful? Yes | No

    Default Re: touble with a time calculation

    Simple here is and example from wiki

    http://www.picbasic.co.uk/forum/cont...USB-SD-LOGGING

    or is it simple?

Similar Threads

  1. Help with calculation
    By Megahertz in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 28th August 2012, 18:10
  2. CHECKSUM CALCULATION, Please Help!
    By wasilus in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 2nd August 2012, 08: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, 06:10
  4. calculation
    By lerameur in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 20th May 2008, 17:28
  5. CRC Calculation - Need a little help
    By Steve43 in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 13th March 2005, 02: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