andre_teprom

[SOLVED] What is the purpose of a variable w/ no assignment ?[IEC 61131-3 (ST)]

4 posts in this topic

Hello,


The program I'm working on, which was written by another professional who does not work in the company anymore.

My doubts lie in the programming language itself, namely IEC-61131-3 (ST).

In a section of the program (PRG) code, a BOOL variable appears without any assignment or evaluation, only itself followed by a semicolon, as this:

PLC_Ok;

I did not understand what the purpose of this, could anyone give an insight ?

Thanks in advance.

Edited by andre_teprom
tagged as solved

Share this post


Link to post
Share on other sites

Never seen that... and I've done a bit of ST.

1 person likes this

Share this post


Link to post
Share on other sites

Once I also did not see anything similar anywhere, I was guessing it could be just to assynchronously force the update of the variable value before the next Task() iteration, but I'm happy that I'm not the only one which found this somewhat weird.

Thanks for your note.

Share this post


Link to post
Share on other sites

Just giving a feedback, I was able to determine the likely reason for the variable being inserted into the program with no apparent reason; After I added another input card into the set, I noticed that a variable associated with an HW input of the new card was being linked to a low priority task. Only after I put this variable in the same way above (without reading or writing to it) inside a PRG file, the compiler assigned the variable to the highest priority task, instead. I believe that the case mentioned in post #1 above was a mere forgetting of the previous programmer, whose null allocation should have been performed only to him be able to debug the its working by checking its operation throught the IDE itself...just guessing.

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