Topic: DMD0209

User Created Data Blocks


In addition to the Built-in data blocks and structures, the programmer can create as many additional data blocks and structures as memory allows.

Creating Data Blocks

Using the Add Memory Block dialog found on the Memory Configuration tab of the System configuration utility, the programmer can create a data block and give it a name, select the type of data the block will contain, specify the number of elements the block will have, and specify what portion that block will be retentive.

 

The programmer can create blocks of simple data types such as Bits, Unsigned Bytes, Signed Bytes, Unsigned Words, Signed Words, Signed DWords, and Reals.

 

The programmer can also create blocks of structures such as Timer Structures, Counter Structs, Strings, PID Structs, Date/Time Structs, Task Structs, Ramp/Soak Structs, Program Structs, Device Reference Structs, and Drum Structs.

 


Creating Heap Items

Heap Items are created automatically when an instruction that requires one is added to the Do-more Designer project, For example, when a PID instruction is added the instruction editor prompts the programmer for the PID Struct. After entering a valid name for the PID Struct notice that the "dot" in the Struct field is yellow, not green. This indicates that the PID Struct name is valid but the structure does not yet exist, but will be created when the editor is closed. This method gives the programmer the ability to create instructions that use large data structures one-at-a-time, as needed.

 

 

Creating new heap items causes changes to the system configuration, which can only be downloaded to the controller when it is in STOP mode. This situation can be avoided by creating the heap items ahead of time. There are two ways to do this:
 

1. Use the Add Heap Item dialog found on the Memory Configuration tab of the System Configuration utility to create single ”Heap Items” where there is only one item of that data-type with the given name.

 

For example, the programmer could create PID_0, PID_1 and PID_2, download the new system configuration to the controller, and when they are added to the project the editor "dot" would be green instead of yellow indicating that the controller already has that element in it's memory.
 

 

2. Use the Add Memory Block dialog found on the Memory Configuration tab of the System Configuration utility to create a block of the needed Struct type.

 

For example, the programmer could create block of three PID Structs named MyPID, and download that to the controller. These PID Structs can now be referenced as MyPID0, MyPID1 and MyPID2 in the project.

Another advantage to creating a block of the structures is their fields can be indirectly referenced like all of the Built-in data blocks, for example MyPID[V0].SP.


See Also:

 


Related Topics:

 


Copyright © Host Engineering, Inc. ALL RIGHTS RESERVED