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

‫جامعة األزهــــر – غـــــــــزة‬

Al Azhar University – Gaza

FACULTY OF ENGINEERING AND


INFORMATION TECHNOLOGY

DEPATMENT OF MECHATRONICS

PIC Microcontroller

Propeller Clock

Mohamed Soliman El Amassi 20130701


Ala'a Wael Mourtaja 20130982
Raed Osama Aklouk 20130917

SUPERSIED BY
Dr. Mohammed Aqel

DECEMBER 2016

SEMESTER I 2016/2017

i
ACKNOWLEDGEMENT

Praise and thanks to Allah first and foremost whose blessing enabled us to
accomplish this project.
We wish to express my deepest appreciation to our Dr. Mohammed Aqel
and for relentless guidance, helpful suggestion, close supervision and moral
encouragement to complete this project.
A special thanks to our parents and to all our teachers I have had.
Our sincerely thanks to all those whom directly or indirectly help us to
complete this project.

ii
ABSTRACT

In this report of PIC microcontroller project, we explain the propeller clock.


At the first talk an introduction about propeller clock, how it works; at the next
talk object of selecting this project, then talk about tool that used to do project,
then talked about the designing of propeller clock; at first, we show the
designing of it, then the shows the designing the connection and overview of
project, before the end we show the code, at the final take about conclusion of
project.

iii
TABLE OF CONTENTS

TITLE PAGE

Propeller clock 1

1. Introduction 2

2. Objectives 2

3. Requirement 2

3.1 Software 2

3.2 Hardware 2

4. Background 3

4.1 PIC 16f84a 3

4.2 DC motor 4

4.3 led 5

5. Design 5

5.1 Design of propeller clock 5

5.3 Connection and overview 5

5.3 Design of the circuit in protues 6

5.4 The project after manufacturing 7

5.5 The propeller cock during running 7

6. Code 8

7. Conclusion 9

iv
TABLE OF FIQURE

FIGURE NO. TITLE PAGE

1. Diagram of PIC 16f84a. 3


2. Diagram of DC motor component. 5
3. Diagram of propeller clock. 5
4. Diagram of connection of project. 5
5. The circuit of propeller clock at proteus. 6
6. The PCB layout of the circuit. 6
7. The project after manufacturing 7
8. propeller cock during running 7

v
PROPLLER
CLOCK

1
1. Introduction

In this project, our aim is to make Propeller Clock that contains a dc motor
12 V, row of a seven yellow leds, and Pic16f84a that it is programed on micro
C program that will be shown in the next pages that when the motor is rotating
the microcontroller keeps switching leds off and on, one after another, very
rapidly. Due to the slow response of the human eye, we get the impression that
the lights are on all together and we can read or display the digital clock.

2. Object of project

1. To design a display system using LEDs which rotate on a motor.


2. To design a program using MikroC language.
3. To display clock using LEDs.
4. To develop software that can generate LEDs display with accurate
synchronization and timing.

3. Project Requirement
3.1 Software:
1. Micro C program: use to write the code.
2. Proteus: use to make simulation to the circuit.
3. K150 software: use to write code on PIC 16f84a.
3.2 Hardware
1. Programmer for the Microcontroller.
2. pic 16f84a.
3. leds.
4. Resistance (220 ohm,10K ohm).
5. Crystal 4Mhz, capacitor(33pf).
6. Power supply.
7. Wires.

2
4. Background

4.1 PIC16F84A

PIC16F84A is an 8-bit microcontroller which means that it is capable of


processing only 8-bits at a time. It also comes in various packages. But
we are only concerned with the PDIP (Plastic Dual Inline Package) which
is normally used by hobbyists. Following are the specifications of the
PIC16F84A
 Only 35 Instructions – which makes it a popular RISC (Reduced
Instruction Set Computer).
 Operating frequency – up to 20 MHz
 64 Bytes of data EEPROM
 Operating voltage – 2.0 to 5 volts
Features:
 13 I/O pins – You can configure the 13 pins either as input or output
individually.
 Each pin can source/sink 25mA current.
 Flash memory can be erased/written 10,000 times.
 EEPROM memory can be erased/written 10,000,000 times
 In built Watchdog timer.

Figure 1: Diagram of PIC 16f84a.

3
As you can see, it is an 18 pin IC. Below are the pin descriptions:
Pin 5: Vss – This is the ground pin of the IC and must be connected to the
negative terminal of the battery.
Pin 14: Vdd – This is the supply pin of the IC and must be connected to the
positive terminal of the battery.
Pin 4: MCLR – Memory Clear. This is a active low pin.
Pins 15&16: Oscillator in/out – here you connect a crystal oscillator. Maximum
frequency you can use is 20MHz. You can use a 4MHz crystal also. The higher
the frequency of crystal used, the faster the controller
Pins 1,2,3,6,7,8,9,10,11,12,13,17&18: These are the 13 I/O pins. They are
grouped into two groups. Port A which contains 5 pins (17,18,1,2&3) and Port B
which contains 8 pins (6,7,8,9,10,11,12&13)
As mentioned earlier, these 13 I/O pins can be individually configured either as
input or output and each pin can supply (source) or it can absorb(sink) a
maximum of 25mA current.

4.2 DC Motor
DC motors seem quite simple. Apply a voltage to both terminals, and it will spin. DC
motors are non-polarized which means that it can reverse voltage so the motor will
rotate in two directions, forward and backward. Typical DC motors are rated from about
6V-12V. The larger ones are often 24V or more but for the purpose of this project, it is
necessary to use 6V-12V range motor. Voltage is directly related to motor torque. The
more voltage supplied, the higher the torque will be produce. Specifications of most DC
motors show high revolutions per minute (rpm) and low torque.
The DC motor is popular in a number of drive applications due to its simple operation
and control. By referring Figure 3.5, it has 2 main parts which is rotor and stator. Stator
is the part where the permanent magnet situated and used to generate the magnetic
field and it is static. Rotor is the rotary part in the motor and contains block of core and
wire loops. It also called the armature.

4
Figure 2: Diagram of DC motor component.
4.3 LED
A led (light-emitting diode) is a semiconductor light source. LEDs are used as
indicator lamps in many devices, and are increasingly used for lighting.
Introduced as a practical electronic component in 1962.Early LEDs emitted
low-intensity red light, but modern versions are available across the visible,
ultraviolet and infrared wavelengths, with very high brightness.
5. Design:
5.1 Design of propeller clock project.

Figure 3: Diagram of propeller clock.


5.2 Connection and overview

Figure 4: Diagram of connection of project.

5
5.3 Design circuit at proteus.
First, we have to make a design on proteus for the circuit to test it and
make it ready for PCB printing, the figure below show the proteus design
and connection and the PCB layout of the circuit.

Figure 5: The circuit of propeller clock at proteus.

Figure 6: The PCB layout of the circuit.

6
5.4 The project after manufacturing.

Figure 7: the propeller clock after finishing the manufacturing.

5.5 The propeller cock during running.

Figure 8: the propeller clock during running.

7
6 Code:
int i ; int j ; int d1 ; int d2 ; int d3 ; int d4 ; int d5 ; // identify variable will used.
const int number[11][5]= { //identify array that contain the shape of number.
{0,0,231,0,0}, // the shape of " : " .
{62,65,65,65,62}, // the shape of number zero "0"
{0,64,127,66,0 },// the shape of number one"1"
{70,73,81,97,66 },// the shape of number two "2"
{49,75,69,65,33} , // the shape of number three "3"
{16,127,18,20,24} , // the shape of number four "4"
{57,69,69,69,39} , // the shape of number fife "5"
{48,73,73,74,60} , // the shape of number six "6"
{3,5,9,113,1} , // the shape of number seven "7"
{54,73,73,73,54} , // the shape of number eight "8"
{30,41,73,73,6},// the shape of number nine "9"
};
void print_number(int x) { //Function for printing the shape of number.
for(i=0;i<5;i++) { portb=number[x][i] ; delay_us(270) ; }
portb=0 ; delay_us(300) ;}
void main() {
trisb=0; // make portb as output
d1 = 2 ; d2 = 0 ; d3 = 3 ; d4 = 1 ;d5 = 1 ;//give initial value of variable that will
display the initial number of clock.
while(1) {
for(j=0 ; j<25 ; j++ ) {
print_number(d5) ;//will display the first digit of minutes.
print_number(d4) ;//will display the second digit of minutes.
print_number(d2) ; //will display the shape of " : ".
print_number(d3) ; //will display the first digit of hours.
print_number(d1) ; //will display the second digit of hours.
delay_ms(20) ;} ++d5;
if(d5==11){++d4;d5=1;}// increase the second digit of minutes every 10 minutes.
if(d4==7){++d3;d4=1;} // increase the first digit of hour every 60 minutes.
if(d3==11){++d1;d3=1;} // increase the second digit of hour every 10 hours.
if(d1==2&&d3==4){d5=1;d4=1;d3=1;d1=1;}} // if the clock be 12:59 will make it to
initial state.

8
7 Conclusion

After the final, we learn how to make project from first to final, learn how to
face problem during designing and solve it, learn how to apply the science
that we learn to make project.
We hope we will be successful in view of our project and we take Excellent
degree.

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