<< Click to Display Table of Contents >> Home mIoTa BASIC > mIoTa BASIC Language Reference > Data Types |
There are 10 different Data Types available in mIoTa BASIC.
The most widely used of these are Boolean, Byte, Word, Integer, Doubleword, Longinteger and String.
The others, IPAddress, MACAddress, ROMAddress are more unusual and have been designed to help simplify the use of network and 1-Wire© communications.
The following is a short description of each Data Type and how much memory each type consumes ..
Type |
Description |
Memory Used |
BOOLEAN |
A single bit variable and has only two possible values, 1 or 0. mIoTa BASIC has several Boolean constants already defined to make programs easier to read.
0 can be written as ‘OFF’ or ‘FALSE’ 1 can be written as ‘ON’ or ‘TRUE’
Note: As a Boolean is stored as a single byte, if the byte contains anything other than 0 then the result will be read as 1 (True), otherwise 0 (False). |
1 byte |
BYTE |
An 8 bit number variable that has a value of 0 to 255 |
1 byte |
WORD |
A 16 bit number variable that has a value of 0 to 32767 |
2 bytes |
INTEGER |
A 16 bit number variable that has a value of 32768 to 32767 |
2 bytes |
DOUBLEWORD |
A 32 bit number variable that has a value of 0 to 4294967295 |
4 bytes |
LONGINTEGER |
A 32 bit number variable that has a value of -2147483648 to 2147483647 |
4 bytes |
IPADDRESS |
A variable containing an Internet Protocol Address (IPv4). This is a 32 bit variable that represents the address of a device on a network. In mIoTa BASIC these are written in human readable form as four bytes (0-255) separated by a ‘.’ and preceded by an ‘@’ sign.
E.g. myip = @192.168.0.1; |
4 bytes |
MACADDRESS |
A variable containing a Media Access Control Address (MAC address). This is a 48 bit variable representing the unique identifier assigned to a devices network interface (Wifi or Ethernet). In mIoTa BASIC these are written in human readable form as 6 Hexadecimal bytes (00 to FF) separated by a ‘:’ and proceeded by an ‘&’ sign.
E.g. mymac = &00:05:4F:80:00:FF; |
6 bytes |
ROMADDRESS |
A variables containing a 1-WIRE device address. This is a 64 bit variable representing the unique identifier assigned to a 1-WIRE bus device. In mIoTa BASIC these are written as a long hexadecimal number preceded by a ‘#’ sign.
E.g. myrom = #28E3D1E302000073; |
8 bytes |
STRING |
A variable containing a set number of bytes (also known as characters or char’s) up to a total of 128. The number of bytes in the string is set by the user, at design time, according to the maximum size that will be required as the string is used. Strings must be enclosed in single quotes.
E.g. mystr = ‘Hello, this is a string’; |
Size set by the user +1 byte |
Note: In mIoTa BASIC, the concepts of Boolean logic (False or True), Binary bits (0 or 1) and numerals (zero or greater than zero) have been intertwined to try and simplify commands where possible.