PWRITE *XAR7,loc16
6-299
PWRITE *XAR7,loc16 Write to Program Memory
SYNTAX OPTIONS OPCODE OBJMODE RPT CYC
PWRITE *XAR7, loc16 0010 0110 LLLL LLLL X Y N+5
Operands *XAR7 Indirect program−memory addressing using auxiliary register XAR7,
can access full 4Mx16 program space range (0x000000 to 0x3FFFFF)
loc16 Addressing mode (see Chapter 5)
Description Load the program−memory location pointed to by the ”*XAR7” with the
content of the location pointed to by the “loc16” addressing mode:
Prog[*XAR7] = [loc16];
On the C28x devices, memory blocks are mapped to both program and data
space (unified memory), hence the ”*XAR7” addressing mode can be used
to access data space variables that fall within the program space address
range.
With some addressing mode combinations, you can get conflicting
references. In such cases, the C28x will give the “loc16/loc32” field priority
on changes to XAR7. For example:
PWRITE *XAR7,*−−XAR7 ; *−−XAR7 given priority
PWRITE *XAR7,*XAR7++ ; *XAR7++ given priority
Flags and
Modes
None
Repeat This instruction is repeatable. If the operation follows a RPT instruction, then
it will be executed N+1 times. When repeated, the ”*XAR7”
program−memory address is copied to an internal shadow register and the
address is post−incremented by 1 during each repetition.
Example
;
Copy the contents of Array1 to Array2:
; int16 Array1[N]; // Located in data space
; int16 Array2[N]; // Located in program space
; for(i=0; i < N; i++)
; Array2[i] = Array1[i];
MOVL XAR2,#Array1 ; XAR2 = pointer to Array1
MOVL XAR7,#Array2 ; XAR7 = pointer to Array2
RPT #(N−1) ; Repeat next instruction N times
||PWRITE *XAR7,*XAR2++ ; Array2[i] = Array1[i],
; i++