Data Types

Luna knows a selection of standard numerical and special data types.

Overview Data Types

Name lowest value highest value Type Size
Boolean false1) true2) Variable 1 Byte
Byte 0 255 Variable 1 Byte
Int8 -128 127 Variable 1 Byte
UInt8 0 255 Variable 1 Byte
Integer -32768 32767 Variable 2 Byte
Int16 -32768 32767 Variable 2 Byte
Word 0 65535 Variable 2 Byte
UInt16 0 65535 Variable 2 Byte
Int24 −8.388.608 8.388.607 Variable 3 Byte
UInt24 0 16.777.215 Variable 3 Byte
Long 0 4.294.967.295 Variable 4 Byte
UInt32 0 4.294.967.295 Variable 4 Byte
LongInt −2.147.483.648 2.147.483.647 Variable 4 Byte
Int32 −2.147.483.648 2.147.483.647 Variable 4 Byte
Single –3,402823E38 +3,402823E38 Variable 4 Byte
String 0 Zeichen 254 Zeichen Object-Variable 2 Byte
MemoryBlock nil MemoryBlock 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
user-defined ? ? Objekt-Variable ?

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
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 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:

  • 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.

1) false = 0
2) true = <>0