Step by Step to Program PIC18F452 Using ICD3

MPLAB Driver Switcher

  1. You will be using the MPLAB ICD3 to re-program Qwikbug onto the Qwikflash board (picboard).
  2. Plug in ICD 3 to the top left front USBport and the RJ11 (short jumper cable) into the top left of the Qwikflash board (DO NOT turn it on)
  3. Open MPLAB driver switcher
  4. Highlight ICD 3 AND select Group Driver Selection to be Applied: MPLAB8

  1. Select apply changes and wait until the message Apply Changes Done is displayed at the bottom of the main window.
  2. Unplug the ICD 3

MPLAB IDE 8.3

  1. Make sure MPLAB IDE version is v8.30 and above.
  2. Disconnect the Serial Cable (DB9/tan cable) from the Qwikflash board
  3. Download <QB452 v1.24> structure assembly codes from to local computer. The file name is QB124.asm.
  4. Open MPLAB IDE v8.30 and expand so it fits the screen
  5. Create a new project using Project Wizard (Project -> Project Wizard)
  6. From Welcome page, selectNext>

10.2In Step One window, make sure in the Device window, select PIC18F452, then select Next>

10.3 In Step Two window, select SASM in Active Toolsuite. In Toolsuite Contents window, SASM and MPLINK should be shown up. Move mouse to highlight SASM, check the Location window, use Browse to select sasm.exe file; then highlight the MPLINK, use Browse to select mplink.exe file. Then press Next>

10.4In Step Three window, use Browse to select the path and give the name of new Project File, then press Next>

10.5In Step Four window, leave it blank, press Next>

10.6In Summary window, check the information are correct, then press Finish button.

11Then get the following window. Use mouse to select the Source Files folder in .mcw window. Right clock the mouse to pull down a menu, then select <Add Files…>

12It will open an Add Files to Project window, as below. Select the QB124.asm, then open the file.

13You will get the following window

14. Build your project (Project -> Build). You should see the follow results.

  1. Click OK of the pop up window. You will get the following output:
  1. On the toolbar, got to Programemer > Select Programmer> MPLAB ICD 3
  2. Plug the ICD 3 into the top left USB port
  3. You get the following window
  1. Flip the swtich to turn on the Quickflash board. You will get a Voltage caution window as below. Press OK button to close the pop-up window.
  1. You should get the following message in Output window:

Target Detected

Device ID Revision = xxxxxxxxx

  1. Go to Configuration Bits window to modify configuration bits (Configure > Configuration Bit…). Uncheck the box: Configuration Bits set in code. Expand each column if need be to see more clearly. Window will pop up, Press ok
  1. Then make sure the following configuration is as follows:

OscillatorHS

Osc. Switch EnableEnable

Power Up Timer Enable

Brown Out DetectEnable

Brown Out Voltage4.5V

Watchdog TimerDisabled- Controlled by SWDTEN bit

Watchdog Postscaler1:128

CCP2 MUXRC1

Stack Overflow ResetEnable

Low Voltage ProgramDisabled

Code Protect 06000-07fffEnable

All others configuration bits should be as Disabled as indicate in the following window:

  1. Go to ICD settings window by Programmer > Settings…
  1. Select: Manually select memories and ranges, check program, configuration, EEPROM, and ID under memories and make program memory range from 0 to 7fff. Check erase all before program under program options and program after successful build under automatically
  1. Erase the device by selecting Programmer > Erase Flash Device
  1. Select Programmer > Program. It will take about 1 minute to complete the programing
  1. You should get the following message from the Output window:

Programming …

Programming/Verify complete

  1. Select Programmer > Reconnect. Press ok when voltage caution window pops up
  1. Select Debugger > Select Tool > MPLAB ICD 3 as in the following window.
  1. If this window pops up press ok and ok when the voltage caution window pops up

The program may freeze for a second at this point. It is ok.

  1. You will then get this screen, move the QB124.APR window out of the way (do not minimize it will pop back up)
  1. Then run the debugger by Debugger > Run, then press YES on the pop up Target Out Of Date window.
  1. You will then get the following screen:
  1. Make sure under configure>configure bits, code protect 06000-07FFF is still enabled.
  2. Select Debugger>Program and you will get the following pop up window
  1. Press OK and wait until programming is complete
  1. Run the debugger again by selecting Debugger>Run
  1. After a few seconds, you should get an error message “Failed to get PC” in the output window as below

Once the error message is printed, disconnect the RJ11 cable from the Qwikflash board and connect the serial cable(DB9 connector). Open tera term pro and press enter a few times. You should get the following window:

While still in tera term pro, turn off the qwikflash board and turn it back on. You will get the following window and qwikbug has been installed

  1. If after a few seconds you do not get the error message as above, but the debugger continues to run, move your mouse to the upper right hand corner of MPLAB IDE 8.3 and press the halt (pause) button wait for “The failed to get PC” error message as above and continue as in step 38.