Sie sind auf Seite 1von 4

Testing the PIC Microcontroller (PIC16F84A)

Experiment no. ______

II. TOOLS AND EQUIPMENT


(1) PIC16F84A
(1) Rolling Robot with (4) 1.5-V battery
(1) PC with PICBASIC PRO/PICBASIC
(1) PIC loader
III. PROCEDURE
1. Study the PIC16F84A pin configuration given in Figure 1. There are 5 pins for
port A that can be used for sensors, LED display or LCD display. There are 8
pins for port B that can be used also for LED display, LCD display, sensors, or
motor/servo applications.

PIC 16F84A

I. OBJECTIVE
1. To become the basic PIN configuration of basic PIC microcontroller such as
PIC16F84A.
2. To familiarize with PICBASIC PRO programming to simulate the PIC
microcontroller.

Figure 1
2. Study also the schematic of rolling robot using the said PIC in Figure 1. Locate
each component indicated below and tell which port the said component(s)
connected to. Use the ohmmeter to test for continuity. Make sure that the
power supply is off.
Components
LED 1
LED 2
Buzzer/ Q1/ 100
Right Servo
Left Servo
Extra Servo

Port(s) of PIC16F84A

4. With your program ran in Microcode studio, look for the HEX file and run it in
your burners program. The PIC16F84A must be loaded in the zip socket of the
burner. Wait until the program burned in your PIC. After burning the program,
load the PIC into your robot socket and test your program/s if your robot
follows your desired output.

PIC 16F84A

3. Testing the LEDs. With the LED 1 and 2 connected in your Table of STEP 2,
write this program in your Microcode Studio/ Plus and run it. Make sure you
select the right PIC module in your microcode studio.
Loop:
HIGH portb.0
LOW portb.1
PAUSE 500
LOW portb.0
HIGH portb.1
pause 500
Goto Loop

5. In STEP 3 program, what do b and 1 (or 0) indicate?


_______________________________________________________________________________
_____________________________________________________________________________
6. What does an HEX file means? Why a PIC microcontroller like PIC16F84A does
requires it for burning programs?
_______________________________________________________________________________
_______________________________________________________________________________
_______________________________________________________________________________
___________________________________________________________________________
7. SOUND command
SOUND PIN, [Note, Duration, {Note, Duration,}]
Using sound command will generate a tone and/or white noise on the
specified pin. Pin is automatically made an output. Note 0 is silence. Notes 1127 are tones, and Notes 128 255 are white noise. Note 1 is about 78.74 Hz
and Note 127 is about 10,000 Hz.
Test this short program:
Sound PORTB.4,[100,10,100,10]
8. Upon doing STEP 7, running and burning it in your pic, did you hear a sound?
a. Yes
b. No
If you dont heard a sound, try troubleshooting the problem, and find out your
missed.
9. Running a Servo. Just like Parallaxs BS2 microcontroller, PIC has the same
time duration for stop (center), forward (clockwise), or backward
(counterclockwise), only this time they are in pulse duration, and not in pulse
count. Figure below shows the pulse width in millisecond.
10. Run and burn the following programs to your PIC
counter

VAR

Byte

For counter = 1 to 50
Pulsout portb.5, 150
Pause 20
Next
For counter = 1 to 100
Pulsout portb.5, 200
Pause 20
Next
For counter = 1 to 100
Pulsout portb.5, 100
Pause 20
Next
Goto start
end of program
Note: in this program, 150 pulse width (or duration) may not be the center or
midrange position of your servo, i.e., if the servo is a modified one.

PIC 16F84A

start:

Figure 2
11. In your program of STEP 10, write a comment after the pulsout command,
preceded by an apostrophe to indicate a comment of what pulse width
indicates (stop, forward, backward).
12. Find the center pulse or center pulse width of the servo you are assigned with
your robot by revising the program in your STEP 10. Write your program at the
back of your manual.
13. Make a program to incorporate the LED blinking, sound, and servo motor
controlling. The program should drive the robot to move forward, while RED
LED (LED 1) blinking. For every turn of the way the second LED (yellow or
green) will blink, while the first LED will stop emitting light. Make a rectangular
path. Beginning and ending in your program, a sound could be heard. You may
write your program at the back of any page of your experiment manual.

PIC 16F84A

14. Make a program to cause the robot to travel in a circular path moving forward
direction. After completing the path, make a backward movement forming a
bigger circle than the first one. Incorporate a LED blinking, and sound effect in
your program.

Das könnte Ihnen auch gefallen