beautypg.com

4 utility rom examples, 1 reading constant word data from flash, 21 .4 utility rom examples -9 – Maxim Integrated MAX31782 User Manual

Page 222: 4utilityromexamples, 1readingconstantworddatafromflash

background image

MaximIntegrated 21-9

MAX31782 User’s Guide

Revision 0; 8/11

21.4UtilityROMExamples

21.4.1ReadingConstantWordDatafromFlash

UROM_moveDP0inc equ 08494h
move DPC, #1Ch

; Set all pointers to word mode

move DP[0], #(table + 8000h) ; Point to address of data as viewed in the Utility ROM

memory map

lcall #UROM_moveDP0inc
move A[0], GR

; A[0] = 1111h

lcall #UROM_moveDP0inc
move A[1], GR

; A[1] = 2222h

lcall #UROM_moveDP0inc
move A[2], GR

; A[0] = 3333h

lcall #UROM_moveDP0inc
move A[3], GR

; A[1] = 4444h

sjump $
org 0100h
table:

dw 1111h, 2222h, 3333h, 4444h

21.4.2ReadingConstantByteDatafromFlash(IndirectFunctionCall)

INDX_moveDP0inc equ 4
move DPC, #1Ch

; Set all pointers to word mode

move DP[0], #800Dh

; Fetch location of function table from Utility ROM

move BP, @DP[0]

; Set base pointer to function table location

move Offs, #INDX_moveDP0inc ; Set offset to moveDP0inc entry in table
move A[7], @BP[Offs]

; Get address of moveDP0inc function

move DPC, #00h

; Set all pointers to byte mode

move DP[0], #((table * 2) + 8000h) ; Point to address of data as viewed in the Utility ROM memory

map and convert to byte mode pointer

lcall A[7]

; moveDP0inc

move A[0], GR

; A[0] = 34h

lcall A[7]

; moveDP0inc

move A[1], GR

; A[1] = 12h

lcall A[7]

; moveDP0inc

move A[2], GR

; A[2] = 78h

lcall A[7]

; moveDP0inc

move A[3], GR

; A[3] = 56h

sjump $
org 0100h
table:

dw 1234h, 5678h