Go to Post You can't lose if you submit an animation. Even if you don't win an award, your team wins by just doing it. - David Brinza [more]
Home
Go Back   Chief Delphi > FIRST > General Forum
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 19-07-2011, 23:02
Pat McCarthy Pat McCarthy is offline
FiM Volunteer
FRC #0067 (HOT Team)
Team Role: Alumni
 
Join Date: May 2003
Rookie Year: 2003
Location: Grand Rapids, MI
Posts: 593
Pat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond repute
Send a message via AIM to Pat McCarthy
Question 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;
__________________
2003-2006: FRC Team 67 - Drafter, Driver, Student Leader
2006 Volunteering: Kettering Kickoff Ref, Team Ford FIRST Robotics Invitational Ref
2007 Volunteering: GLR Field Reset/Repair; WMR Robot Inspector and Scorekeeper; MARC Referee
2008 Volunteering: WMR Planning Committee, WMR Scorekeeper, MARC Ref, IRI Scorekeeping, WMRI Scorekeeping & DJ
2009 Volunteering: Kettering District, MARC, IRI, and WMRI Scorekeeper/Field Power Controller
2010 Volunteering: Kettering District, MARC, IRI, and WMRI Scorekeeper/Field Power Controller
2011 Volunteering: Waterford District, West Michigan District, MARC, & IRI DJ
2012 Volunteering: Waterford District, West Michigan District DJ
Reply With Quote
  #2   Spotlight this post!  
Unread 19-07-2011, 23:33
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,582
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Help needed with RSLogix 5000

You have 7 if's but only 6 end_if's.
Reply With Quote
  #3   Spotlight this post!  
Unread 20-07-2011, 16:52
Pat McCarthy Pat McCarthy is offline
FiM Volunteer
FRC #0067 (HOT Team)
Team Role: Alumni
 
Join Date: May 2003
Rookie Year: 2003
Location: Grand Rapids, MI
Posts: 593
Pat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond repute
Send a message via AIM to Pat McCarthy
Re: Help needed with RSLogix 5000

Quote:
Originally Posted by Joe Ross View Post
You have 7 if's but only 6 end_if's.
Thanks! That was it!
__________________
2003-2006: FRC Team 67 - Drafter, Driver, Student Leader
2006 Volunteering: Kettering Kickoff Ref, Team Ford FIRST Robotics Invitational Ref
2007 Volunteering: GLR Field Reset/Repair; WMR Robot Inspector and Scorekeeper; MARC Referee
2008 Volunteering: WMR Planning Committee, WMR Scorekeeper, MARC Ref, IRI Scorekeeping, WMRI Scorekeeping & DJ
2009 Volunteering: Kettering District, MARC, IRI, and WMRI Scorekeeper/Field Power Controller
2010 Volunteering: Kettering District, MARC, IRI, and WMRI Scorekeeper/Field Power Controller
2011 Volunteering: Waterford District, West Michigan District, MARC, & IRI DJ
2012 Volunteering: Waterford District, West Michigan District DJ
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 03:26.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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