Instruction Set ArchitectureIP2022 Users Manual
148
www.ubicom.com
instruction can only be executed from program
RAM. For more information, see Section 3.7.
Cycles:
1
Example:
mov w,#0x01;load W with 0x01
mov addrx,w;copy W to ADDRX
mov w,#0x83;load W with 0x83
mov addrh,w;copy W to ADDRH
mov w,#0x80;load W with 0x80
mov addrl,w;copy W to ADDRL
mov w,0x1FE;copy 0x1FE to W
mov datal,w;copy W to DATAL
mov w,0x1FF;copy 0x1FF to W
mov datah,w;copy W to DATAH
fwrite
;write flash memory
This example writes the 16-bit data held in the
DATAH/DATAL register to address 0x18380 in
program
flash
memory.
First,
ADDRX/ADDRH/ADDRL
is
loaded
with
0x018380. Then, DATAH/DATAL is loaded from
0x1FE and 0x1FF. Finally, the fwrite
instruction loads program flash memory from
DATAH/DATAL with the data that came from
registers 0x1FE and 0x1FF.