IAP calls or In Application Programming, gives access to a number of ROM routines to write flash, enable low power modes, get device IDs and other operations. With the inline Assembly capability of BASIC, it is easy to make these calls.

For the LPC1768 we needed access to getting the device ID, in order to use that unique number to generate a MAC address number for an Ethernet connection. Here is an example to excercise that operation.


#include "ASMinlineBASIC.bas"

dim COMMAND(4)
dim RESULT(4)

main:

COMMAND(0)= 58

x = addressof COMMAND
ASM_MOV(r0,r7)

x = addressof RESULT
ASM_MOV(r1,r7)

CALL (&H1FFF1FF1)
for x=0 to 4
    print hex(RESULT(x))
    y = y + RESULT(x)
next

print hex(y)

Next Post Previous Post

  0