Logic Question...

Discussion in 'C-Touch/HomeGate/SchedulePlus/PICED Software' started by pgordon, Jun 22, 2006.

  1. pgordon

    pgordon

    Joined:
    Nov 16, 2004
    Messages:
    123
    Likes Received:
    2
    Consider the following code scenario:

    SetLightingState("Bathroom", ON);
    .
    ... Some more code....
    .
    once GetLightingState("Bathroom") = ON then
    .
    ... Some code..
    .
    end;




    All this is in a single module. In this case, does the [once GetLightingState("Bathroom") = ON] get executed in the SAME loop, or the NEXT loop? - in other words, will the ONCE condition "see" the change in state of the "Bathroom" group within the same loop, or is it necessary to finish the loop and start another one before the change in state is seen? - I think I might be tripping up on this point, since I'm expecting the changed state to be seen immediately, so that both parts of the code get executed in the same loop....

    Thanks all

    Paul G.
     
    pgordon, Jun 22, 2006
    #1
  2. pgordon

    Darren Senior Member

    Joined:
    Jul 29, 2004
    Messages:
    2,361
    Likes Received:
    0
    Location:
    Adelaide, South Australia
    This will all get executed in the same scan (aka "loop"), hence the second bit of code will be affected by the first.

    All code in all modules gets executed from start to finish on every scan. The only exceptions are if a Module is disabled or delaying.
     
    Darren, Jun 23, 2006
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.