pointers
* (ARM peripheral and memory access)
equivalent of PEEK and POKE
* variable
* constant ' for array of constants, string or bytes
* (
expression) '
added in version 8.04 of the compiler
The C pointer syntax is used to give direct access to the ARM peripheral
registers and memory.
x = *addr ' equivalent of PEEK(addr) for a word
*addr = x ' equivalent of POKE(addr,x) writes x as a word into address addr
This gives the programmer the ability to directly control the ARM hardware. Details on what the registers do can be found in the NXP User Manuals for the corresponding chip (LPC2103 for ARMmite, ARMexpress LITE, PRO, LPC2106 for ARMexpress, LPC2138 for ARMweb, and LPC1751/6 for the PROplus and SuperPRO)
Examples of programming the registers can be found in the BASIClib directory which contains sub-programs that control various hardware functions.
If you prefer the PEEK or POKE versions you can always use the pre-processor
#define PEEK(addr) (*(addr))
' the () ensure only addr is used in the address calculation
#define
POKE(addr,value) *(addr) = value
Pointers only operate on 32 bit WORD values, and should use WORD or 4-byte alligned addresses.
For byte and halfword access see RD_BYTE , WR_BYTE , RD_HALF and WR_HALF