arcotangente

Structured text syntax error

4 posts in this topic

I'm writing a Function Block in Structured text language. I'm only testing, so the function doesn't do what it has to do.

However, my first step is make a for loop inside a while loop, this is for increment the value of a index register while a condition is true.

 

My code so far:

 

WHILE X100 DO;
    
    FOR ID_INDEX := 0 TO 99 BY 1 ID_INDEX;
        ID_INDEX := ID_INDEX + 1;
    END_FOR;          
         
END_WHILE;  

 

X100 is my boolean for general start. ID_INDEX is the index for a array that I want to manipulate.

 

The errors that GXWORKS2 tells me are the following:

 

-  Cannot find 'END_WHILE' in a statement. Please check the error display statement or the preceding one.    C8006

-  Parser error.    C1200

 

This is the first time that I write code on Mitsubishi structured text, so I based on the examples that I saw on the structured text manual.   

Edited by arcotangente

Share this post


Link to post
Share on other sites

WHILE X100 DO
    
      FOR Index := 0 TO 99 BY 1 DO
    Array1[Index] :=0;
    END_FOR;
         
END_WHILE; 

Share this post


Link to post
Share on other sites

WHILE DO does not get a semicolon...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now