Professional Documents
Culture Documents
AL Azhar University-Gaza
FACULTY OF ENGINEERING
AND INFORMATION TECHNOLOGY
DEPARTMENT OF MECHATRONICS ENGINEERING
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:
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.
;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