6.6 Read from Address (ReadFromAddress) Pseudo Operation

Format:
oData = ReadFromAddress (address)
Purpose:
  • To send 32 bits of data to the device memory.
Description:
  • The 32-bit data is read from the memory at the address specified in the address parameter.
Restrictions:
  • The device must be in Debug mode.
Example:
  • The following is an example of how to use the ReadFromAddress function for PIC32MX, PIC32MZ and PIC32MK devices:
    ReadFromAddress (address)
    {
    // Load Fast Data register address to s3
    instruction = 0x3c130000;
    instruction |= (0xff200000>>16)&0x0000ffff;
    XferInstruction(instruction); // lui s3, <FAST_DATA_REG_ADDRESS(31:16)> - set address of fast
    data register
    // Load memory address to be read into t0
    instruction = 0x3c080000;
    instruction |= (address>>16)&0x0000ffff;
    XferInstruction(instruction); // lui t0, <DATA_ADDRESS(31:16)> - set address of data
    instruction = 0x35080000;
    instruction |= (address&0x0000ffff);
    XferInstruction(instruction); // ori t0, <DATA_ADDRESS(15:0)> - set address of data
    // Read data
    XferInstruction(0x8d090000); // lw t1, 0(t0)
    // Store data into Fast Data register
    XferInstruction(0xae690000); // sw t1, 0(s3) - store data to fast data register
    XferInstruction(0); // nop
    // Shift out the data
    SendCommand(ETAP_FASTDATA);
    oData = XferFastData(32'h0x00000000);
    return oData;
    }