You are on page 1of 4

-

AL Azhar University-Gaza
FACULTY OF ENGINEERING
AND INFORMATION TECHNOLOGY
DEPARTMENT OF MECHATRONICS ENGINEERING

Embedded System design


Lab Report
Experment No.Two
Prepared by :
MOHAMMED RIYAD AL- NAJJAR
ALI HAMZA MUKAT
Presented to :

Eng. Mohammed Aqel

November 18, 2007


First semester, 2007/2008

Scrolling LED's
Objectives:
To Make a synchronizing output at the port of PIC16F84A .
To interface LED's and make a program to flash LED's for 1 second
In forward and backward direction, this in turn can be used to a flashing shapes

Introduction:

The purpose of this experiment is to make LED's interfaced with PIC16F84A to


flash on and off for 1S in a sequence in opposite direction .

Requirements:
Hardware :
1) PIC16F84A with it's 4MHz Oscillator and two 30pF capacitor .
4) Pull up Resistor 10K
5)8x Resistors 150
6)Eight LED's

Software:
1)Proteus
2) PIC Basic compiler
4)IC prog

Background :
The circuit contains basically the PIC16F84A which won't be run without the
resonator which provides 4MHz frequency and connected to pins OSC1 and
OSC2 with the two 33PF capacitors as discussed in the previous experment.
The 10k Pull-up resistor is connected to MCLR pin.
The LED's will be connected to the port B of the microcontroller thrugh the 150
resistor .
After connection of the hardware, we will make the LED to light for 1S and then
will off and the second LED will be on at the time that the previous LED is off
and so on.
After reaching the last LED the sequence will be repeated but this time in the
opposite direction.

The Circuit Diagram:


The circuit was simulated in proteus software .

The code of program:


This code was written in Pic basic pro .
TRISB=$00
TRISA=$01
PORTB=$00
PORTA=$00

;PORTB as output
; PORTA as input
;intiailzation

SYMBOL LEDS=PORTB
SYMBOL SWITCH=PORTA.0
I VAR BYTE
MAIN:
LEDS=0
FOR I=0 TO 7
IF SWITCH=0 THEN GOTO MAIN
LEDS =DCD I

; variable

; scrolling from 0 to 7
;switch is closed

PAUSE 1000
NEXT
FOR I=6 TO 1 STEP -1
IF SWITCH=0 THEN GOTO MAIN
LEDS = DCD I
PAUSE 1000
NEXT
GOTO MAIN
END

Comments :
1)
2)

; scrolling from 0 to 7

You might also like