Unity Pro DDT

V

Thread Starter

Vinod

I cannot give located physical address for DDT (Derived Data Types ) elements. Only option is to give a starting address for the DDT itself. If my DDT contains different datatypes, the address allocation is not proper. Any thoughts on this?
 
We are running into the same problem. It looks like if you mix and match data types such as real, int, and bool, it assigns your addressing for you.

You can re-order so it is a better fit though. For example, we have 5 REAL's followed by 2 INT's and then 10 BOOLS. (Note that BOOL's use a byte of a word.) If we start at MW3000, 17 words are used, MW3000 to MW3016. Be sure to add some spares in case you want to add a real or a bool later.

Another approach is to make a separate DDT for BOOLS, REALS, INTS, etc. For example have MOTOR_Bool for your first DDT and have MOTOR_Real for your second DDT. This way you can use M1000 for your BOOL's and MW3000 for your reals. This would save memory since we are not wasting 7 bits for each BOOL this way.
 
The reason why you can only assign the first address is that DDTs are stored in contiguous memory. You assign an address to the entire DDT, and the software takes care of the rest. This makes things easier when you add an element to the DDT later, because addresses do not have to be manually changed. In the past, I have had to change 100's of addresses because I forgot to include an element at the beginning. This saves a lot of time when several instances of the DDT are used (ie array of structures), and the instance of the DDT is addressed.
 
Top