previous page next page reference home emBASIC home page

13 System data
EmBasic has several system areas available for user. There are system variables (primitive and compound) and system constants.
13.1 Memory access
There are system variables (arrays) to access controller memory:
@MEMORY8 of type BYTE
@MEMORY16 of type WORD
@MEMORY32 of type LWORD.
They may be used in expressions and in assignments:
@memory16[800000h] |=[AS41][WLG42][NM43] 100h
These constructs are necessary to access processor i/o pins or internal peripherals like counters or ADCs on systems where there is no Express-i/o layer to support process i/o. The TLCS900 processors have their internal registers for i/o access starting at address 0, the processor handbook has tables at the end listing all registers and their meaning. Please always consult the boards schematics to see which other devices could be affected by writing to a certain port as.
Bitwise write is a problem on TLCS900 because many registers cannot be read back. Shadow registers would have to be introduced to allow different tasks to access the same memory bits without altering the contents of other bits. mCAT problem

No sanity check can be made during memory accessing – use them at your own risk!


13.2 System constants
[AS44][WLG45][NM46]Many constants have been defined using mCAT documentation. Some constants are not hardware specific:
$VERSION
- Kernel version
$BUILD
- Build number
$COUNTRY
- Country information
$TERMINAL
- Terminal specification array (each serial line can have its terminal)
$TIMEZONE
- Current time zone[WLG47][NM48]

The rest of constants are hardware specific and described in the mCAT documentation.
13.3 System variables
Following the list of system variables, where TASK corresponds to the desired task/sequence or SELF for the current task.
@CONSOLE
Default emBASIC console
@TASK.ERRCODE
Last error code, where name is task name or SELF
@TASK.NAME
Current task/sequence name
@TASK.ID
Process identifier
@CONSOLE
Default emBASIC console
@TIMEFAC
Time factor for *ALL* timed commands
@TASK.ERRCODE
Last error code
@DEBUG
Debug output channel (will be removed in release version)
@SER[chan].SPEED
Serial speed (SERIAL configuration replacement)
@SER[chan].MODE
Serial mode (SERIAL configuration replacement)
@SER[chan].PARITY
Serial parity (SERIAL configuration replacement)
@SER[chan].HANDSHAKE
Serial handshake (SERIAL configuration replacement)
@TASK.LINE
Current ex[NM49]ecution line of code[WLG50]
@MEMORY8[addr]
Byte memory access (MEMBYTE replacement)
@MEMORY16[addr]
Word memory access (MEMWORD replacement)
@MEMORY32[addr]
LWORD memory access(MEMLONG replacement)