User Defined Data Types

Intrinsic Data Types

Intrinsic means that the variable value is interpreted as a memory address. Pointer, string variables, and memory blocks are therefore intrinsic variables.

String

A string is bound of random characters. Any kind of alphabetical or numerical information can be stored as a string. "Dr. Who", "13.11.1981", "23:42" are examples of strings. In LunaAVR strings can also contains binary data, e.g. zero bytes.
In the source code strings are embedded in quotes. The maximum length of a string in LunaAVR is 254 bytes. The default value is "" (empty string). LunaAVR stores strings in the Pascal format, embedded in a MemoryBlock-Object.

String variables occupy at least 2 bytes in memory (pointer to memoryblock object). However, Eeprom static strings specify the corresponding number of bytes in the eeprom memory. A string-variable dimensioned in the working memory (SRAM) is a 16-bit-pointer to a MemoryBlock of dynamical size.

String constants are stored in the program segment (flash) and occupys the number of bytes of the string-data + one byte at the first for the length (Pascal-String).

MemoryBlock

The data type MemoryBlock is a direct Object reference (and also a 16-bit-pointer) to a MemoryBlock-Object. This allows direct access to the reserved memory within the MemoryBlock-Methods and Properties.
Example of a variable declaration with different data types in memory:

Pointer

Pointer are also intrinsic variables like a MemoryBlock (16-Bit-Pointer to a Memory location), but pointers have a special ability: you can assign values like integer variables​and perform calculations with them. Furthermore, the object functions of the MemoryBlocks also applies. Example p.ByteValue (0) = 0x77, etc. is possible.
Since the controller has three different memory segments, also three different pointer types have been implemented as a new data type. These are: