Example #1
0
        private void downloadGO()
        {
            panelDownload.Visible    = false;
            panelDownloading.Visible = true;
            buttonHelp.Enabled       = false;
            buttonBack.Enabled       = false;
            buttonNext.Enabled       = false;
            buttonCancel.Enabled     = false;
            buttonCancel.Text        = "Exit";
            this.Update();

            if (radioButtonSelfPower.Checked)
            {
                Pk2.ForceTargetPowered();
            }
            else
            {
                Pk2.ForcePICkitPowered();
            }
            if (ptgMemory <= 5)
            {
                Pk2.EnterLearnMode(ptgMemory); // set memory size to use
            }
            else
            {
                Pk2.EnterLearnMode(0); // default to 128K on illegal value
            }
            if (fastProgramming)
            {
                Pk2.SetProgrammingSpeed(0);
            }
            else
            {
                Pk2.SetProgrammingSpeed(icspSpeedSlow);
            }

            PICkit2WriteGo(true);

            Pk2.ExitLearnMode();

            if (ptgMemory <= 5)
            {
                Pk2.EnablePK2GoMode(ptgMemory); // set memory size to use
            }
            else
            {
                Pk2.EnablePK2GoMode(0); // default to 128K on illegal value.
            }
            Pk2.DisconnectPICkit2Unit();

            panelDownloading.Visible  = false;
            panelDownloadDone.Visible = true;
            buttonHelp.Enabled        = true;
            buttonNext.Enabled        = true;
            buttonNext.Text           = "Next >";
            buttonCancel.Enabled      = true;
            timerBlink.Enabled        = true;
        }