Logo Search packages:      
Sourcecode: odyssey version File versions

bool PicDevice::program_cycle ( uint32_t  data,
uint32_t  mask = 0xffffffff 
) [protected, virtual]

Perform a single program cycle for program memory. The following steps are performed:

  • The data is written to the PIC with write_prog_data().
  • The BEGIN_PROG command is sent.
  • A delay of program_time is initiated.
  • If the PIC requires it, the END_PROG command is sent.
  • A readback is performed and is compared with the original data.
    Parameters:
    data The data word to program into program memory at the PIC's program counter.
    mask A mask which is used when verifying the data. The read back data and the data parameter are both masked with this mask before being compared. This is required for properly verifying the configuration word.
    Returns:
    A boolean value indicating if the data read back matches the data parameter.

Definition at line 131 of file PicDevice.cxx.

References COMMAND_BEGIN_PROG, COMMAND_END_PROG, flags, Device::io, PIC_REQUIRE_EPROG, program_time, read_prog_data(), IO::usleep(), write_command(), and write_prog_data().

Referenced by Pic16Device::program_one_location(), and Pic16Device::write_config_word().

                                                          {
      this->write_prog_data(data);
      this->write_command(COMMAND_BEGIN_PROG);
      this->io->usleep(this->program_time);
      if(this->flags & PIC_REQUIRE_EPROG)
            this->write_command(COMMAND_END_PROG);

      if((read_prog_data() & mask) == (data & mask)) return true;
      return false;
}


Generated by  Doxygen 1.6.0   Back to index