Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   General Forum (http://www.chiefdelphi.com/forums/forumdisplay.php?f=16)
-   -   Help needed with RSLogix 5000 (http://www.chiefdelphi.com/forums/showthread.php?t=96315)

Pat McCarthy 19-07-2011 23:02

Help needed with RSLogix 5000
 
Hi! I'm hoping there is someone out in the CD community who has some experience using Structured Text with RSLogix 5000.
Using a variety of sources, I am unable to determine what I am doing wrong with the syntax of my code.

When I verify the code shown below, I receive the following errors:
Error: Line 2: Keyword "END_IF" expected
Error: Line 29: Unexpected end of text found

Code:

// If no rows have only 1 light...
if ((ROW1_Value <> 1) AND (ROW2_Value <> 1) AND (ROW3_Value <> 1)) then
        if (ROW2_Value > 0) then ROW2_Value := 1;                                                        // Then check for the first row
        elsif (ROW1_Value > 0) then ROW1_Value := 1;                                                // to have greater than 0 and set it to 1
        else ROW3_Value := 1; end_if;

// Else if only one row has 1 light left...
elsif((ROW1_Value = 1) XOR (ROW2_Value = 1) XOR (ROW3_Value = 1)) then                // XOR to check for only 1 row having 1 light left.
        if((ROW1_Value = 1) AND (ROW2_Value >= 0) AND (ROW3_Value >= 0)) then                // First possibility
                if(ROW2_Value >= 2) then ROW2_Value := 0;
                        else ROW3_Value := 0; end_if;

        elsif((ROW1_Value >= 0) AND (ROW2_Value = 1) AND (ROW3_Value >= 0)) then        // Second possibility
                if(ROW1_Value >= 2) then ROW1_Value := 0;
                        else ROW3_Value := 0; end_if;

        elsif((ROW1_Value >= 0) AND (ROW2_Value >= 0) AND (ROW3_Value = 1)) then        // Third possibility
                if(ROW2_Value >= 2) then ROW2_Value := 0;
                        else ROW3_Value := 0; end_if;

// Else if two rows have only 1 light left...
elsif( ((ROW1_Value = 1) AND (ROW2_Value = 1)) OR ((ROW1_Value = 1) AND (ROW3_Value = 1)) OR ((ROW2_Value = 1) AND (ROW3_Value = 1)) ) then
        if((ROW1_Value = 1) AND (ROW2_Value = 1)) then ROW1_Value := 0;
        elsif((ROW1_Value = 1) AND (ROW3_Value = 1)) then ROW3_Value := 0;
        else ROW2_Value := 0; end_if;

// Else if all three rows have 1 light left...
else ROW2_Value := 0;

end_if;


Joe Ross 19-07-2011 23:33

Re: Help needed with RSLogix 5000
 
You have 7 if's but only 6 end_if's.

Pat McCarthy 20-07-2011 16:52

Re: Help needed with RSLogix 5000
 
Quote:

Originally Posted by Joe Ross (Post 1069751)
You have 7 if's but only 6 end_if's.

Thanks! That was it!


All times are GMT -5. The time now is 11:48.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi