Sign in to follow this  
Followers 0
Geo1000

Internal function block variables

6 posts in this topic

I have a function block where the first internal variable is showing as address H1420 in the Global Symbol table. When I add another retained variable to the function block then save and compile the code, the variable address in the global symbol table shifts from H1420 to H1488.  I need to retain the address as I will be downloading code and I need to ensure the address if H1420 stays with that variable. 

 

Can anyone help with this?

Share this post


Link to post
Share on other sites

In general, you should try to avoid this as it ruins the portability of a Function Block and you can only then have one instance of the FB.  But, I understand sometimes this is a desired setup, so here is the answer:

You need to point the variable at H1420 and you use the AT field to do this.  When creating the variable (or after you have created it, you can edit it) choose the advanced button as shown below.  Next, check the AT box and assign an address to the variable.  It says it is limited to H0-H511 and I might recommend that you use that area as the higher addresses are used for non-AT FB variables, but I believe it will actually let you put H1420 in there (but choose something in H0 - H511 :-) ).

5c7024c2afa76_ATVar.jpg.63a9ede079b885bc

Share this post


Link to post
Share on other sites

Thanks Michael. I tried that, but it threw up a compile error saying 'This address is reserved for Function Block use'........

I've spoken to my service team and they are okay with the values being over written, but it's annoying me. 

Thanks again

Share this post


Link to post
Share on other sites
12 hours ago, Geo1000 said:

Thanks Michael. I tried that, but it threw up a compile error saying 'This address is reserved for Function Block use'........

I've spoken to my service team and they are okay with the values being over written, but it's annoying me. 

Thanks again

Yes, that is what I was saying, choose a different address between H0 and H511 (rather than H1420).  Then set it to that address and it will not change.

Share this post


Link to post
Share on other sites

Ah, but the problem is that address H1420 in the old code holds a value I don't want to delete (it's an Installation Date variable). The address in the new code needs to be  H1420 as well otherwise when I download it, the display shows a meaningless variable as the original H1420 has been overwritten. The other problem is that the code is being downloaded using a memory cassette, so there is no way we can change the variables as the field operatives don't have CX one.........

Share this post


Link to post
Share on other sites

Ok, then change the memory range that the function blocks will use.  To do this, go to the PLC pull down menu and choose the option shown below:

FBMem1.thumb.jpg.49fbee5f094d2981b404749

Then setup how much H memory you want to use and where to start with each area. Note that there are two areas that use the H area by default.  You can use areas that don't affect H1420, or you can change the area to the DM area and avoid HR all together.  Just make sure not to interfere with any areas that you are using for something else and stay out of the D20000 and up range (unless you really are aware of the areas that the Special I/O modules and CPU Bus Units are using and know that you are not using those areas currently or in the future).  To be safe, if you have EM available, I might recommend that if you want to leave the H area. 

FBMem2.jpg.69cb67fb4476ceab9c3d919a3ba5e

Of course you will need to be able to download this at least once to make these changes take effect.  So, if no one in the field has CX-Programmer, this might not fix your issue.

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
Sign in to follow this  
Followers 0