Вы находитесь на странице: 1из 4

TECHNOLOGICAL UNIVERSITY OF THE

PHILIPPINES
COLLEGE OF ENGINEERING
Electronics Engineering Department
Microprocessor Systems, Lab.
Experiment No. 1
I.
II.

GENERATING AN OUTPUT
OBJECTIVES
Upon the completion of this lab, you should be able to:

III.

Familiarize the basic syntax used in preparation of a program;


Device, Declare, Symbol, DelayMS, While-Wend
Compile and download the program to the PIC.
Test the program loaded in the PIC using LED.

MATERIALS
Hardware:

IV.

PICKIT 2
USB cable
LED
Connecting wires
PIC16F877A

METHODOLOGY
1. Set up the Software
Open the Proton IDE.
Click ton File New.
Type the program below:
Experiment 1
Generating Output
Blinking Lights
Device 16F877A

Declare XTAL 4
Symbol LED = PORTB

Alias LED to PORTB

DelayMS 500

Wait for PIC to stabilize

TRISB = %00000000

Set PORTB (RB0 to RB6) to all output


% = BINARY
$ = HEXADECIMAL

While 1 =1

While-Wend

LED = $FF
DelayMS 1000

Turn LEDs on
Delay for 1 second

LED = $00
DelayMS 1000

Delay for 1 second

Wend

2. Compile your program (F9).

Click on the button Compile Only (F9) located at the upper left
of the Proton IDE or you can simply press F9 on your
keyboard.
A window (Save as) will appear asking you where you would
like to save your files. It is convenient to create a new folder
for the generated files by the compiler.
A hex file would be generated if the compiler doesnt detect
any error.
If an error is detected within your program, it will be shown in
the results window located below the screen of the Proton IDE.

3. Setup the programmer.

Connect the PICKIT 3 to the computer via USB cable and to


the Module. Make sure that no other wires are connected to
the Module except for the PICKIT 3.
Open the PICkit 3.

Click on Tools Check Communication.


PICkit 3 would indicate PIC Device Found. If an error
message appeared, check your connection from the PICkit 3
to the module. This may be caused by reversed connections.
Click on File Import Hex (Ctrl + i) and open the .hex file of
your program.
Click on Write and wait for the message Programming
Successful. (Do not attempt to disconnect the device while
doing this process.)

4. Setup the Hardware.

V.

Place the PIC16F877A to PIC socket.


Connect the LED socket to PORTB of PIC as shown in Figure 1.

RESULTS
The experiment had required us to generate an output using
PICkit3 and LED. But our group had decided to use PICkit2 instead
because it almost has the same characteristics as PICkit3 but with
cheaper price. But the PICkit2 is not complete so we assembled the
slot for the pic16f877a and the LEDs. After making it, we created
the program for the blinking lights. And after the program is saved,
it must be compiled and loaded into the microcontroller so that it
will execute the program loaded. In performing the experiment, all
of the devices must be connected properly so that you may not
encounter any problems in executing program. Also, the
connections in the microcontroller must be in proper place so that
the destruction of pic16f877a will be avoided.

VI.

CONCLUSION
The experiment wants to show the basic syntax used in PIC
programming and how it operates. It also gave ideas to each user
on how to be familiar to the programming environment. It also
helped them to generate outputs by compiling the made program
and then importing it to the compiler in order for the PICkit to
perform the given instructions by the code. Also, the users have
chosen to use PICkit2 instead of PICkit3, but still, the program used
and the syntaxes are still the same. Using the Proton IDE, the
program is successfully compiled and imported to the PICkit and the
output is shown through the LED.

VII.

GROUP MEMBERS
Group No. 5
DAMGO, JOHN CARLOS M.
JUNIO, GENER D.
MAMARIL, JOHN JERIC R.
MATIENZO, RONALYN N.
NATABIO, GESSEL S.

Вам также может понравиться