MIRTOS System Definition Files


Addresses328.Def, Addresses1284.Def, and Addresses2560.Def
There are three (3) Address definition files, one for each of the target Microcontrollers (MCUs) which MIRTOS supports.  Each file contains the absolute FLASH address of all of the system functions for that MCU. To access a MIRTOS system function directly, use the address shown in the file for the MCU that you're using.  Remember to include the 'A' prefix character.  To call the PrintFLASHString subroutine, which outputs a string that resides in FLASH memory to the serial port, for example, use the "CALL  APrintFLASHString" Assembly statement after the register setup logic.

BinDefs.Def
The Assembler parses decimal number string and hexadecimal number string (i.e., those that begin with "0x") correctly.  The meaning of Assembly source code is often more clear if a string representing a binary value is used.  These strings begin with uppercase 'B' (for binary), followed by one (1) to eight (8) characters, which can only be zero (0) or one (1).  The value 0 can be represented in up to eight (8) ways: "B0", "B01", "B001", "B0001", "B00001", ,B000001", "B0000001", and "B00000001", for example.  The value 0x64 hexadecimal, which is 100 decimal (i.e., base 10), is represented by either binary string "B1100100" or "B01100100".  The BinDefs.Def file defines all possible combinations of Binary strings that represent the values from 0 to 255 decimal (= "B11111111") as constants, allowing those strings to be used throughout the Assembly source code.

As an example, input just the following three (3) lines into the online Assembler and run it.
   LDI   R30, 0x64
LDI R30, B01100100
LDI R30, 100
The listing results should be:
  0:   e4 e6          ldi    r30, 0x64      ; 100
2: e0 e0 ldi r30, 0x00 ; 0
4: e4 e6 ldi r30, 0x64 ; 100
All three source code lines were expected to have generated the same Assembly listing output.  The one with the Binary string constant clearly does not.  Now just insert the following line before the first line, and run the online Assembler again.
.INCLUDE "BinDefs.Def"
This is the resulting listing output, with the binary constants now defined and utilized:
  0:   e4 e6          ldi    r30, 0x64      ; 100
2: e4 e6 ldi r30, 0x64 ; 100
4: e4 e6 ldi r30, 0x64 ; 100

CommonDefs.Def
This file has definitions for constants like "ON", "OFF", "RUN", "STOP", "TRUE", and "FALSE".  It also has the bit assignments and bitmask results used by the DumpMemory, FormatULONG, FormatULONGHex, ParseValue, and ParseValueAfter System routines.

Indices.Def
This file contains the Jump Table index for each MIRTOS System Routine.  It must be included whenever using the indirect routine access method.  Each of the routine names has an "I_" prefix, which is a reminder that it is an index into the System Jump Table.  It is loaded into R30 immediately prior to a CALL, RCALL, JMP, or RJMP to address 0, which is called "SoftVector".  Here is an example of how indices would be used:
.INCLUDE "Indices.Def"

SoftVector: ; This is at FLASH address 0

.ORG 0x02F0

Shared_PrintRegs:
LDI R30, I_PushAll ; As if "PUSH R31", "PUSH R30", ..., "PUSH R0" were called
RCALL ASoftVector ; PushAll MUST use a CALL or RCALL, whether direct or indirect
LDI R30, I_DumpRegs_Begin ; Display the contents of all Registers, and optionally, the
RCALL ASoftVector ; stack contents as well
LDI R30, I_PopAll ; Executes "POP R0", "POP R1", ..., "POP R31", and "RET"
RJMP ASoftVector ; PopAll MUST be executed using JMP or RJMP

One nice aspect of using this indirect access method is that the source code is the same for the 328P, 1284P, and 2560 MCUs.  That is, the Addresses328.Def, Addresses1284.Def, and Addresses2560.Def files need not be used unless both direct and indirect access modes are utilized.

IOM328P.Def, IOM1284P.Def, and IOM2560.Def
There are three (3) files which contain PIN, PORT, and REGISTER definitions; there is one for each of the target MCUs which MIRTOS supports.  When using a named ATmega REGISTER (e.g., SPH, SPL, SREG), PORT (e.g., PINB, DDRB, or PORTB), or PIN (e.g., PINB0, DDB1, PORTB2) directly, include the appropriate IOM*.Def file.  Those PINs, PORTs, and REGISTERs may then be referenced by name.  If one of those is referenced but the appropriate .DEF file is not included, the output will likely have a zero in place of the numeric value of the desired PIN, PORT, or REGISTER.  The numbered REGISTERS (e.g., R0, R1, through R31) are not included, since they are already known by the Assembler.

nRF24L01.Def
MIRTOS supports the Nordic Semiconductor ® nRF24L01+ Single Chip 2.4 GHz Transceiver.  Nordic has provided a Product Specification document, version 1.0, dated September, 2008, which has detailed information about configuring and using this device.  This definition file for that radio defines the Register and BIT constants used by MIRTOS for it as well as the layout of the 32-BYTE configuration structure in EEPROM.  A default configuration for both Primary Receive (PRX) and Primary Transmit (PTX) modes for the device are contained in each MIRTOS device's EEPROM, along with a 16-BYTE identifying string for each. . Those 96 BYTEs can be used for some other purpose if no nRF24L01+ radio is utilized.  The SPI pins that MIRTOS uses for each type of microcontroller is documented in this file, as well as the pin header layouts for common nRF24L01+ devices' SPI ports: the 2 x 4 pin and the 1 x 8 pin versions.

SystemEEPROM.Def
The first eighty (80) BYTEs of EEPROM in each of the MCU types are reserved for MIRTOS use.  This file contains the definitions of how they're are used.  All of the System EEPROM BYTEs can be displayed sending the "DSE" (or "DES") command to the serial port.  As an example, the BYTE at EEPROM address 0 is named EEbBootOptions, and the one at address 1 is named EEbSystemMode.  The bits in the first one select options which occur during a reboot.  Those in the second one select one or more system modes to enable, among them: Automatic Analog-To-Digital conversions, level display, pump control, script execution, sequencer, and multitasking (or Task List).

SystemFLASH.Def
Most of the first 256 BYTEs of FLASH are used by MIRTOS.  This file contains the names and locations of the constants in that area.  Some of them include the boot-up clock speed (8 or 16 MHz), the device code, the device description and copyright strings, nine (9) unsigned long integer (i.e., 4-BYTE) values used during long division, and the device serial number.  Although there are a few unused BYTEs in that area of FLASH, it probably a good idea not to use them.

SystemSRAM328.Def, SystemSRAM1284.Def, and SystemSRAM2560.Def
There are three (3) SRAM (or RAM) address definition files, one for each of the target Microcontrollers (MCUs) which MIRTOS supports.  Each file contains the addresses for the System variables and constants in SRAM.  These include bit definitions, as well as the locations of the keyboard input and output buffers, and where the results of the automatic Analog-To-Digital conversions are placed, for example.


Downloads page