Geo1000

Function Block addressing

4 posts in this topic

Hello all. 

I have a program which has 8 function blocks.

I recently added extra functionality to one of the programs (not the function blocks).

I added the new variables to the global symbols table and added the new code, but when I compiled the new code, the variable addresses in three of the function blocks had changed. This is a problem, because we use memory cassettes to download new versions of code, so when the new version is downloaded to a machine in some far flung part of the world, these variables will be overwritten (they are hours run variable, so are important for servicing purposes).

 

My understanding is that CX assign's variable addresses in Function Blocks and we have no control over this. Bit if I only added variables to the Global symbol table, why are the FB addresses affected??

 

Any input appreciated. 

Share this post


Link to post
Share on other sites

Hello All,

I was wondering if anyone had looked at this topic and had any thoughts? Why would adding variables to the Global Table have an affect on the Function Block Variables???

Thanks,

George

Share this post


Link to post
Share on other sites

The idea of function blocks is to make them completely portable.  Trying to use the address inside function blocks completely defeats that purpose.  If you need to use a variable in the function block, bring it outside (output or input functionality) the function block and tie it to addresses that way.  By design, you should not care what addresses the inside of the function block is using.  I am afraid that there is not really an answer for your problem.  

In answer to this question:

My understanding is that CX assign's variable addresses in Function Blocks and we have no control over this. Bit if I only added variables to the Global symbol table, why are the FB addresses affected??

Did you assign addresses to the global variable table that fall within the memory areas used for FB memory?  If so, this could definitely impact the assignment.  You should avoid using the FB memory areas completely.  

 

Share this post


Link to post
Share on other sites

Thanks Michael,

You've confirmed what I suspected; the original code I am trying to upgrade should not have been written as it was.....Oh well, on-wards and up-wards.

 

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