Professional Documents
Culture Documents
THE PROGRAMMER
Name: ____________________________________ Section: _____________
Professor: ________________________________ Date: ________________
DURATION: 2 Hours
OBJECTIVES:
To be able to learn how to load the source code into the PIC16F84A using
different types of Programmer.
BACKGROUND:
This experiment shows three different ways on how to load the .hex file to the
PICmicrocontroller by using three different types of Programmer’s Kit: Parallel
Programmer, Serial Programmer, and PIC Start Plus.
The Parallel Programmer is a low cost programmer that can be found in number
of electronic stores in Manila. Usually it has associated driver when you purchase it.
There are two freeware software that can be used to drive the Parallel
Programmer, these are, Oshon Soft and PICALL. These two drivers can be downloaded
for free from the following websites; www.oshonsoft.com and www.picallw.com
respectively. But to prevent software conflict, it is recommended to install only one
software, either oshonsoft or picall.
2nd Edition (Evaluation Copy) Prepared by: Engr. Emmanuel T. Longares, PECE 10
The Serial Programmer used in this experiment was constructed based on the
schematic diagram that has downloaded from http://feng3.cool.ne.jp/en/pg5v2.html. The
Serial Programmer is also called Multi PIC Programmer 5V2 and it was developed by
Feng. It is capable of programming 8-pin to 40 pin devices using single ZIF socket [2].
The driver of Serial Programmer is called icprog. The icprog is a third party software
like PICALL and Oshon Soft. It can be downloaded from www.ic-prog.com.
The PICSTART Plus Programmer is product of Microchip Inc. and does not
require third party drivers. The source code can load directly into the PICmicrocontroller
using MPLAB IDE.
MATERIALS/COMPONENTS:
PIC16F84A - 1 piece
4 Mhz Crystal Oscillator - 1 piece
10KOhm resistor (1/4W) - 2 pieces
360Ohm resistor (1/4W) - 3 pieces
Light Emitting Diode (LED) - 3 pieces
Tact Switch - 1 piece
EQUIPMENT:
Computer with installed MPLAB IDE V.8.33
Programmer
Power Supply
TOOLS:
Breadboard
IC Puller
Connecting Wires
Cutter and Long Nose
2nd Edition (Evaluation Copy) Prepared by: Engr. Emmanuel T. Longares, PECE 11
PROCEDURE:
a. If your Programmer is the one with parallel connector like in Figure 2.1,
connect it to your computer’s parallel port before turning on the computer.
Otherwise proceed to Part 2.
b. Turn on the power supply and adjust it to 20Vdc. Connect the positive
terminal of power supply to color pink wire of programmer and negative
terminal to the color gray. Make sure that the power supply is connected in
the correct terminals of programmer to prevent possible damage to the
device.
c. Open the MPLAB IDE software. Using the project wizard, choose PIC16F84A
as the device.
2nd Edition (Evaluation Copy) Prepared by: Engr. Emmanuel T. Longares, PECE 12
d. Create a folder and named it as “Expt_2.1”. Name your project as “LED1”.
Save and place it to Expt_2.1 folder.
e. Compile the copied PIC16F84A template using Ctrl F10 of your keyboard.
Make sure that the template is working properly before proceeding to the next
step.
;**********************************************************************
RESET_VECTOR CODE 0x000 ; processor reset vector
goto start ; go to beginning of program
MAIN CODE
start
; remaining code goes here
nop ; "nop" is Required for Emulators
clrf PORTB
goto $
2nd Edition (Evaluation Copy) Prepared by: Engr. Emmanuel T. Longares, PECE 13
END ; directive 'end of program'
g. Compile the source code. Once compiled successfully, double click the
PICALL icon in your desktop. In the three arrow down buttons of PICALL,
choose PIC16PRO, microchip, and PIC16F84A.
i. Again in the main menu of PICALL, click the File and click Open Program.
Go to your Expt_2.1 folder and open your LED1.hex file. Place your
PIC16F84A IC to the Programmer. Make sure that it is placed properly in
correct position. Then, click config and choose the XT. Click the Program
button in the PICALL and a message “program load successfully in
xseconds” shall appear.
j. Turn off the power supply of Programmer. Using IC puller, remove the
PIC16F84A.
k. Using your tools and materials, construct the circuit shown in Figure 2.2.
VCC
5V
U1
10k Ω R2 17 RA0 VDD 14 R1
18 RA1 RB0INT 6
1 RA2 RB1 7
2 RA3 RB2 8 360Ω
3 RA4T0CKI RB3 9
RB4 10
4 MCLR RB5 11
16 OSC1CLKIN RB6 12
RB7 13
5 VSS OSC2CLKOUT 15
P IC16F84A
2nd Edition (Evaluation Copy) Prepared by: Engr. Emmanuel T. Longares, PECE 14
l. Supply your circuit with 5Vdc. The LED at PORTB0 (pin 6) must light. If not,
check your connections. Make sure that there is no loose connection.
a. If your Programmer is the one with serial connector like in Figure 2.3, connect
it to your computer’s serial port before turning on the computer. Otherwise,
proceed to Part 3.
b. Turn the two switches of Serial Port Programmer to the direction indicated in
Figure 2.3.
Note: In placing the PIC16F84A in the programmer, leave one slot as pointed by
the ball pen shown in figure 2.4.
2nd Edition (Evaluation Copy) Prepared by: Engr. Emmanuel T. Longares, PECE 15
FIGURE 2.4: PIC16F84A Orientation in Serial Port Programmer
Note: The orientation of pins must be similar in figure 2.5. Pin 1 is the one
pointed by the ball pen.
2nd Edition (Evaluation Copy) Prepared by: Engr. Emmanuel T. Longares, PECE 16
d. Compile the source code. Once compiled successfully, click the icprog icon
in your desktop. In the icprog menu, click the open and locate your LED1.hex
file. In the arrow down list of action tool bar, choose the PIC16F84A. Choose
XT in the arrow down list of Oscillator.
f. Using your tools and materials, construct the circuit shown in Figure 2.2.
g. Supply your circuit with 5Vdc. The LED at PORTB0 should light. If not, check
your connections. Make sure that there is no loose connection.
a. If your Programmer is the one with serial connector like in Figure 2.5, connect
it to your computer’s serial port before turning on the computer.
2nd Edition (Evaluation Copy) Prepared by: Engr. Emmanuel T. Longares, PECE 17
b. Type the source code given in Part 1.f.
c. Compile the source code. Once compiled successfully, in the MPLAB menu
click the debugger>select tool>none.
e. Unlock or unzip the PICstart Plus. Place the PIC16F84A to the IC holder and
lock it. Make sure that the IC is placed in the correct orientation before
proceeding to the next step.
f. Load the source code. This can be carried out by clicking the Programmer of
MPLAB menu and click Program.
g. Using your tools and materials, construct the circuit shown in Figure 2.2.
h. Supply your circuit with 5Vdc. The LED at PORTB0 should light. If not, check
your connections. Make sure that there is no loose connection.
Part 4: Exercises
a. Modify the source code given in Part 1 such that a LED at PORTB 5 light.
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
2nd Edition (Evaluation Copy) Prepared by: Engr. Emmanuel T. Longares, PECE 18
________________________________________________________________
________________________________________________________________
b. Modify the source code given in Part 1 such that PORTB0 to PORTB3 light.
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
SUMMARY:
________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
2nd Edition (Evaluation Copy) Prepared by: Engr. Emmanuel T. Longares, PECE 19
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
CONCLUSION:
________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
____________________________________________________________________
RECOMMENDATION:
________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
2nd Edition (Evaluation Copy) Prepared by: Engr. Emmanuel T. Longares, PECE 20
REFERENCES:
Mano, M. Digital Design 4th ed. Singapore: Pearson Education, Asia, 2007
Bartee, T. Computer Architecture and Logic Design. New Jersey: John Wiley &
Sons, 2004
PIC16F84a Datasheet.pdf
http://www.microchip.com
http://www.picallw.com
2nd Edition (Evaluation Copy) Prepared by: Engr. Emmanuel T. Longares, PECE 21