Calculating Time for clock's preset


Closed Thread
Results 1 to 34 of 34

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default

    how about using 2 loops depending on operating output,

    if progon=1 then do turnoff checking ' "otherwise"
    do turn on checking
    '''
    '''
    '''
    turnoff checking stuff
    ''''
    turnon checking stuff

    don

  2. #2
    Join Date
    Jun 2008
    Posts
    84


    Did you find this post helpful? Yes | No

    Default

    Calculating time from Midnight is not possible since it more than 16Bit.
    Moreover, If start time is 13:00:00 and end time is 01:00:00 will be also a problem.

  3. #3
    Join Date
    Jun 2008
    Posts
    84


    Did you find this post helpful? Yes | No

    Default

    Maybe, checking the Seconds can be with > instead of =, since there is no chance that it will miss for more than few seconds.
    Next time if the Program is already On the check will be passed.

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by menta View Post
    Calculating time from Midnight is not possible since it more than 16Bit.
    Moreover, If start time is 13:00:00 and end time is 01:00:00 will be also a problem.
    Which is why I suggested only counting every other second above....
    Or like DT said, you have another bit that'll signify AM or PM...
    Code:
    time_of_day var bit
    am con 0
    pm con 1
    if time_of_day = 0 ' then it must be between 0000 and 1159
    if time_of_day = 1 ' then it must be between 1200 and 2359...

    Or again, you can use a LONG variable type and use a 32 bit (ok, 31 plug a sign) variable type.

  5. #5
    Join Date
    Jun 2008
    Posts
    84


    Did you find this post helpful? Yes | No

    Default

    How do I define LONG variable?
    What do I do with a situation where start is 10:00 and end is 09:00?
    If using AM/PM sign, what do I do if start is at AM and stop is PM ?

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Cool

    Quote Originally Posted by menta View Post
    How do I define LONG variable?
    It's in your PBP manual...just like you define any other variable.

    What do I do with a situation where start is 10:00 and end is 09:00?
    If using AM/PM sign, what do I do if start is at AM and stop is PM ?
    Time to start thinking a bit...
    If it starts at AM, then the flag would equal AM AND the time would match.
    If it starts at PM, then the flag would equal PM AND the time would match.
    Doesn't matter if it starts or stops, it's all in how you set up your If/Then statement to match what YOU want to do.

  7. #7
    Join Date
    Jun 2008
    Posts
    84


    Did you find this post helpful? Yes | No

    Default

    From the HELP "Size is BIT, BYTE or WORD."
    Does the 16F support 32bit ?

  8. #8
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by menta View Post
    From the HELP "Size is BIT, BYTE or WORD."
    Does the 16F support 32bit ?
    Well, you never specified that you were using a 16Fxxx, so I guess you don't get to use a LONG variable.
    And it's not so much if the 16F supports 32 bits, 'cause none of the 10F/12F/16F/18F support 32 bit variables. It's the compiler that either supports them or doesn't.

Similar Threads

  1. I don't understand this code!
    By Russ Kincaid in forum mel PIC BASIC Pro
    Replies: 46
    Last Post: - 13th February 2008, 02:55
  2. Measuring time
    By AugustoPedrone in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 30th July 2007, 23:46
  3. Serout2/serin2 Pbp Problem
    By SOMRU in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 11th December 2006, 19:55
  4. Calculating elapsed time, how?
    By Eng4444 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 1st June 2006, 09:00
  5. Timer in real time
    By martarse in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 29th July 2005, 14:24

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