PreviousNext
copyMemoryBlock
Help > OS functions > Data blocks > copyMemoryBlock

Function

 

Copy specified RAM block to a specified location

Purpose

 

Copy memory block within RAM

Syntax

 

void copyMemoryBlock (uns16 from, uns16 to, uns8 length)

Parameters

 

     from: starting address of the block to be copied

     to: destination address

     length: block length in bytes

Return value

 

  –

Output values

 

  –

Preconditions

 

     Either traditional or linear addresses can be used.

     Upward overlapping the source and the destination RAM blocks being copied is not allowed.

     Avoid writing to RAM areas dedicated to OS, otherwise OS can collapse. See the IQRF OS User’s guide, RAM map.

Remarks

 

See IQRF OS User’s guide, RAM map and Example E06–RAM.

Side effects

 

FSR0 and FSR1 registers are modified.

See also

 

writeToRAM, readFromRAM, setINDF0, setINDF1

Example 1

 

copyMemoryBlock(0x2390, 0x23C0, 10); // copy 10 B block from 0x2390 to 0x23C0

Example 2

 

copyMemoryBlock(bufferRF+10, bufferCOM+1, 8);          // 8 bytes copied:

    // bufferCOM[1] = bufferRF[10] ...  bufferCOM[8] = bufferRF[17]

Example 3

 

copyMemoryBlock(array+0, array+1, sizeof(array)–1);    // Upward, not allowed

Example 4

 

copyMemoryBlock( array+1, array+0, sizeof(array)-1 );  // Downward, allowed