Logic


Closed Thread
Results 1 to 5 of 5

Thread: Logic

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default Re: Logic

    sumplight off time = sumplight on time + sumplight duration
    if sumplight off time > 1440 then sumplight off time = sumplight off time - 1440 and set next day flag

    ...
    then we have a flag (slf) that is 1 when sumplight is on else 0 and a next day flag (ndf) that is set to 1 when offtime overflows else 0
    the ndf flag is cleared at midnight in you time routine , the chklight sub is called once every minute

    chklight: check light subroutine
    if slf=0 then
    if count >= on time then
    slf=1
    offtime = count+duration
    ndf=0
    if offtime >1440 then
    offtime=offtime -1440
    ndf=1
    endif
    turn on light
    endif

    else
    if ndf=1 then return
    if count >= offtime then
    slf=0
    turn off light
    endif
    endif
    return




    return

  2. #2
    Join Date
    Oct 2009
    Posts
    583


    Did you find this post helpful? Yes | No

    Default Re: Logic

    Richard, thanks for the input.

    I've made one modification to include a > in the first line of the code I posted above and it's been running fine. But thanks as always for your contribution

    Malcolm

Similar Threads

  1. Time logic
    By Scampy in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 28th October 2013, 14:40
  2. Logic Probe Recommendations
    By retepsnikrep in forum Off Topic
    Replies: 3
    Last Post: - 12th June 2011, 20:35
  3. PORTA Logic - Be the processor
    By Darrel Taylor in forum FAQ - Frequently Asked Questions
    Replies: 29
    Last Post: - 9th March 2009, 18:18
  4. Logic Level Triac
    By emavil in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 29th November 2006, 18:18
  5. Fuzzy logic?
    By Damir in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 28th August 2006, 12:03

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