Controlling CBus GA using SystemIO

Discussion in 'C-Touch/HomeGate/SchedulePlus/PICED Software' started by dsamson, Dec 9, 2020.

  1. dsamson

    dsamson

    Joined:
    Aug 23, 2004
    Messages:
    46
    Likes Received:
    1
    Location:
    Sydney
    Hi,
    I am trying to control the swimming pool pump speed using an Integer. When the value of the integer is 0, the pump will stop, If the value is between 1 and 9 the pump will run aty Speed 1, between 10 and 99, Speed 2 will be selected and for 100 and above, Speed 3 will be selected.

    I haven't tested if the code works yet but I have this issue:
    "Logic Run-time Error R009 at line 586:0 - C-Bus Messages are being sent on every Scan".

    I do understand the meaning of this message. Is there a workaround to use the System IO to control a CBus GA? I can see another option using levels of a Dummy GA but I would like to see if I can use an IO instead.
    The code is below:

    if (GetIntSystemIO("Pump speed") > 0) then
    begin
    if (GetIntSystemIO("Pump speed") > 9) then
    begin
    if (GetIntSystemIO("Pump speed") > 99) then
    PulseCBusLevel("Local", "Lighting", "Pool Pump Speed3", 100%, 0, "0:00:02", 0%)
    else
    PulseCBusLevel("Local", "Lighting", "Pool Pump Speed2", 100%, 0, "0:00:02", 0%);
    end
    else
    PulseCBusLevel("Local", "Lighting", "Pool Pump Speed1", 100%, 0, "0:00:02", 0%);
    end
    else
    PulseCBusLevel("Local", "Lighting", "Pool Pump Stop", 100%, 0, "0:00:02", 0%);

    Thank you.
     
    dsamson, Dec 9, 2020
    #1
    1. Advertisements

  2. dsamson

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    1,157
    Likes Received:
    119
    Location:
    Adelaide, Australia
    Enclose your whole routine with a haschanged function.

    if hasChanged(GetIntSystemIO("Pump speed") ) then
    begin
    // all your code
    end
     
    Ashley, Dec 9, 2020
    #2
    1. Advertisements

  3. dsamson

    dsamson

    Joined:
    Aug 23, 2004
    Messages:
    46
    Likes Received:
    1
    Location:
    Sydney
    Thank you. I'll try that.
     
    dsamson, Dec 10, 2020
    #3
    1. Advertisements

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.