Gate load delay

Discussion about Gate Builder and variables database creation.
MarkRospen
Posts: 8
Joined: Mon Oct 21, 2019 9:24 am

Gate load delay

Postby MarkRospen » Fri Nov 22, 2019 9:41 am

Hi,

Is there a way with code that I could create a delay where a loading screen is shown until all gates have been read from and then open a new template?

I have tried the code below but when the gate changes in the PLC the template doesn't load and doesn't close the load screen...

function void System_On()
SetDigGateValue("Run_Feeder",1, 0); // Reset Feeder Run Signal
SetDigGateValue("System_Active",1, 1); // Set System Active bit
int GateVal4;
int Temp4;
int mainPage;
GateVal4 = GetDigGateValue("Loaded",1); // Read loaded time delay bit from PLC
Do
Temp4 = 1; // Write temporary bit
while
(GateVal4 < 1) // Wait until Loaded = 1
mainPage=TPageOpen("Menu"); // Open menu template
TPageCloseByName("Loading"); // Close load screen
end

User avatar
admin
Site Admin
Posts: 348
Joined: Tue Nov 17, 2009 1:18 pm

Re: Gate load delay

Postby admin » Fri Nov 22, 2019 10:41 am

Hi,
try this code:

Code: Select all

function void System_On()
#startup

    SetDigGateValue("Run_Feeder",1, 0); // Reset Feeder Run Signal
    SetDigGateValue("System_Active",1, 1); // Set System Active bit

    while (GetDigGateCommunicationStatus("Loaded",1) == false) // wait while comunication go "ok"
        Sleep(200);
    end

    TPageOpen("Menu"); // Open menu template
    TPageCloseByName("Loading"); // Close load screen
end

MarkRospen
Posts: 8
Joined: Mon Oct 21, 2019 9:24 am

Re: Gate load delay

Postby MarkRospen » Fri Nov 22, 2019 10:59 am

Hi,

The code works thank you. However, is there a way to wait until ALL gates have been loaded?

I also get an error when I open the runtime saying "Function already running", any ideas?

User avatar
admin
Site Admin
Posts: 348
Joined: Tue Nov 17, 2009 1:18 pm

Re: Gate load delay

Postby admin » Fri Nov 22, 2019 1:36 pm

Hi, see code:

Code: Select all

function void System_On()
#startup

    SetDigGateValue("Run_Feeder",1, 0); // Reset Feeder Run Signal
    SetDigGateValue("System_Active",1, 1); // Set System Active bit

    int i;
    bool verify = false;

    while (verify == false) // wait while comunication go "ok"

        verify = true;

        // Num gate
        for i = 0 to GetTotalNumGates() do
            if (GetNumGateCommunicationStatus(GetNumGateGateID(i), GetNumGateNID(i)) == false) then
                verify = false;
            end
        end

        // Dig gate
        for i = 0 to GetTotalDigGates() do
            if (GetDigGateCommunicationStatus(GetDigGateGateID(i), GetDigGateNID(i)) == false) then
                verify = false;
            end
        end

        // Str gate
        for i = 0 to GetTotalStrGates() do
            if (GetStrGateCommunicationStatus(GetStrGateGateID(i), GetStrGateNID(i)) == false) then
                verify = false;
            end
        end

        Sleep(200);
    end

    TPageOpen("Menu"); // Open menu template
    TPageCloseByName("Loading"); // Close load screen
end


also get an error when I open the runtime saying "Function already running", any ideas?

I think you entered the function "System_On()" when opening the template. No need because it's already called at startup (#startup)

Regards


Return to “Tags - Gate Builder”

Who is online

Users browsing this forum: No registered users and 1 guest