PreviousNext
setINDF0
Help > OS functions > RAM > setINDF0

Function

 

Write a value in the virtual INDF0 register

Purpose

 

Indirect write to RAM

Syntax

 

void setINDF0(uns8 value)

Parameters

 

value: value to be written

Return value

 

  –

Output values

 

Register addressed by the FSR0H and FSR0L is modified

Preconditions

 

     FSR0 (the FSR0H and FSR0L register pair) must be set before to define a destination. Traditional or linear addressing can be used.

     Avoid writing to RAM areas dedicated to OS and to PIC special function registers otherwise OS can collapse. See IQRF OS User’s guide, RAM map.

Remarks

 

     Simple writing to the INDF0 virtual register is not allowed. Due to security reasons, all instructions using INDF0 are removed during Upload. To avoid unintended behavior all constructions modifying INDF0 (either by the user or by the compiler) should be omitted. Instead of this IQRF OS allows to write to indirectly addressed RAM using extra system function setINDF0. See Example E06–RAM.

     Another possibility (but more code-consuming) is using the writeToRAM function.

Side effects

 

  –

See also

 

setINDF1, writeToRAM, copyMemoryBlock

Example

 

// Block memory copying from bufferRF to bufferINFO
FSR0 = bufferINFO + 5;    // To

for(i = 0; i < 8; i++)

{

  x = bufferRF[i];         // From

  setINDF0(x);

  FSR0++;

}                          // Result is the same as

                           // copyMemoryBlock(bufferRF, bufferINFO + 5, 8)