Luna knows a selection of standard numerical and special data types.
Overview Data Types
|Name||lowest value||highest value||Type||Size|
|String||0 Zeichen||254 Zeichen||Object-Variable||2 Byte|
|sPtr||0||65.535||Pointer (Sram)||2 Byte|
|ePtr||0||65.535||Pointer (Eeprom)||2 Byte|
|dPtr||0||16.777.215||Pointer (Flash)||3 Byte|
See also: SRAM-Variable
User Defined Data Types
The user may define own dta types and structures
See also: Struct-EndStruct
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.
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).
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:
dim a as byte dim b,e,f as integer dim var as single dim meinText as String dim m as MemoryBlock a=1 b=12345 var=0.44234 myText="Dr. Who" m = New MemoryBlock(100)
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 variablesand 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:
- sptr: Pointer to location in the working memory (sram segment)
- dptr: Pointer to location in the program segment (flash/data segment)
- eptr: Pointer to location in the eeprom (eeprom segment)
With Pointer you can access an arbitrary address to the object features. e.g. within a memory block or table in a flash.