Logo Search packages:      
Sourcecode: odyssey version File versions

void Pic18Device::set_tblptr ( unsigned long  addr  )  [protected, virtual]

Sets the value of the PIC's internal TBLPTR register. This register contains the address of the current read/write operation.

Parameters:
addr The byte address within the PIC's address space.

Definition at line 498 of file Pic18Device.cxx.

References COMMAND_CORE_INSTRUCTION, and write_command().

Referenced by erase(), load_write_buffer(), read_config_memory(), read_memory(), write_config_memory(), write_id_memory(), and write_program_memory().

                                               {
      uint32_t ins;

      ins = 0x0e00 | ((addr >> 16) & 0x3f);     /* movlw addr[21:16] */
      write_command(COMMAND_CORE_INSTRUCTION, ins);
      write_command(COMMAND_CORE_INSTRUCTION, 0x6ef8);/* movwf TBLPTRU */
      ins = 0x0e00 | ((addr >> 8) & 0xff);      /* movlw addr[15:8] */
      write_command(COMMAND_CORE_INSTRUCTION, ins);
      write_command(COMMAND_CORE_INSTRUCTION, 0x6ef7);/* movwf TBLPTRH */
      ins = 0x0e00 | (addr & 0xff);             /* movlw addr[7:0] */
      write_command(COMMAND_CORE_INSTRUCTION, ins);
      write_command(COMMAND_CORE_INSTRUCTION, 0x6ef6);/* movwf TBLPTRL */
}


Generated by  Doxygen 1.6.0   Back to index