42319members
209667posts

Unity storing reals on odd addresses. All of my addresses have shifted in a recent rebuild.

Highlighted
Crewman
Crewman

Unity storing reals on odd addresses. All of my addresses have shifted in a recent rebuild.

I have a situation where my program is storing real variables with the starting word is an odd %mw for example %mw1553. My version of the program from a week ago the same real in the same structure was at %mw1554. There is not change to the structure, no new variables added or removed. I was under the impression that all real data types need to start at even address. Can anyone help me find what setting I may have changed or what may have happened here. We are running unity 13.1, and ran an update recently. All I can recall settings wise that has been changed is increasing memory size from 5000 to 7000 and "allowin dynamic arrays". This is an M580 2040 

Tags (2)
7 REPLIES 7
Highlighted
Administrator

Re: Unity storing reals on odd addresses. All of my addresses have shifted in a recent rebuild.

hey @jm , thank you for your question
 
I moved it to this forum when the community of experts will be able to provide you the right support 

 

@Oncom , I know you post a lot about M580 , can you help here please? 

 

 

Oma
Global Community Manager
Community user guide  |   FAQ

Highlighted
Crewman
Crewman

Re: Unity storing reals on odd addresses. All of my addresses have shifted in a recent rebuild.

The reason was due to unity shuffling memory addresses when it is in simulation mode

Highlighted
Commander

Re: Unity storing reals on odd addresses. All of my addresses have shifted in a recent rebuild.

@Omaelk sure.

 

 

 

 

@jm Hi,

do you mean your Odd %MW address is incidentally shifted to Even after you Rebuild? 

 

Actually, Even addressing on Real data type is not new feature. if you try on Unity Pro 8.0 giving Odd address on Real data type variable it would be Error. 

 

 

Highlighted
Crewman
Crewman

Re: Unity storing reals on odd addresses. All of my addresses have shifted in a recent rebuild.

yes I know its not a new feature, that is the problem. In our original developed program we put a ddt at address %mw1000 for example. the first word is at %mw1000, the second thing in there is a real and is placed automatically at %mw1002. If you put your plc in simulation mode it will put the word at %mw1000 and the real at %mw1001

 

For testing a program in simulation mode the plc re positions reals that are in DDTs to be able to start on odd addresses without error. I see this as a huge flaw with the simulator mode, it should act identically to regular operation in terms of memory allocation.  

Highlighted
Commander

Re: Unity storing reals on odd addresses. All of my addresses have shifted in a recent rebuild.

Ok, now I understand what you are facing. 

 

And I try this also on unity 8.0 and control expert 14.1  and you are absolutely right. 😂

 

 

Hi @Omaelk can you mention/forward to M580 Product manager / R&D team. about this issue. Thanks

 

Simulation:

simulationsimulation

 

Standard:

StandardStandard

Highlighted
Lieutenant

Re: Unity storing reals on odd addresses. All of my addresses have shifted in a recent rebuild.

Hello,

The problem comes from the 32 bits alignment in the M580 platforms. If you map a structure on %MW, due to the 32 bits alignment some holes can be created to align the 32 bits variable on even addresses. (DWORD, REAL...) this is not the case when you use the simulator which is based on 16bits alignment. this is due to the legacy platforms which are all 16 bits, when the simulator was developed. This is explained in the online help in the topic: DDT: Mapping Rules.

 

KR

 

Highlighted
Lieutenant

Re: Unity storing reals on odd addresses. All of my addresses have shifted in a recent rebuild.

I just forgot something, There is a warning message that can be triggered in case of mapping compatibility. this message is displayed if Control Expert needs to align the 32 bits variable:

 

2020-01-24_08-31-39.jpg