Logo Search packages:      
Sourcecode: odyssey version File versions

void Pic18Device::write_id_memory ( DataBuffer buf,
unsigned long  addr,
bool  verify 
) [protected, virtual]

Writes the ID memory locations.

buf The DataBuffer from which data is read.
addr The byte address of the ID words in the PIC address space.
verify A boolean value indicating if the written data should be read back and verified.
The progress_count is incremented by the number of words written to the ID locations. If verify is true then progress_count will have been incremented by two times the number of words written; once for the write and once for the verify.
runtime_error Contains a description of the error along with the address at which the error occurred.

Definition at line 180 of file Pic18Device.cxx.

References COMMAND_CORE_INSTRUCTION, COMMAND_TABLE_WRITE, load_write_buffer(), program_wait(), Device::progress(), read_memory(), set_tblptr(), THROW_ERROR, and write_command().

Referenced by program().

      try {
            /* Step 1: Direct access to config memory */
            /* BSF EECON1, EEPGD */
            write_command(COMMAND_CORE_INSTRUCTION, 0x8ea6);
            /* BSF EECON1, CFGS */
            write_command(COMMAND_CORE_INSTRUCTION, 0x8ca6);

            /* Step 2: Configure device for single panel writes */
            write_command(COMMAND_TABLE_WRITE, 0x0000);

            /* Step 3: Direct access to code memory */
            /* BSF EECON1, EEPGD */
            write_command(COMMAND_CORE_INSTRUCTION, 0x8ea6);
            /* BCF EECON1, CFGS */
            write_command(COMMAND_CORE_INSTRUCTION, 0x9ca6);

            /* Step 4: Load write buffer. Panel will be automatically determined
             * by address. */
            load_write_buffer(buf, addr/PANELSIZE, addr%PANELSIZE, true);

            if(verify) {
                  /* Verify the memory just written */
                  read_memory(buf, addr, 4, true);
      } catch(std::exception& e) {
              "Couldn't write ID memory at address 0x%06lx", addr);

Generated by  Doxygen 1.6.0   Back to index