14
“HEAVEN’S LIGHT IS OUR GUIDE” RAJSHAHI UNIVERSITY OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF ELECTRICAL AND ELECTRONIC ENGINEERING

“H EAVEN ’ S L IGHT IS OUR G UIDE ” R AJSHAHI U NIVERSITY OF E NGINEERING AND T ECHNOLOGY D EPARTMENT OF E LECTRICAL AND E LECTRONIC E NGINEERING

Embed Size (px)

Citation preview

Page 1: “H EAVEN ’ S L IGHT IS OUR G UIDE ” R AJSHAHI U NIVERSITY OF E NGINEERING AND T ECHNOLOGY D EPARTMENT OF E LECTRICAL AND E LECTRONIC E NGINEERING

“HEAVEN’S LIGHT IS OUR GUIDE”

RAJSHAHI UNIVERSITY OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF ELECTRICAL AND ELECTRONIC ENGINEERING

Page 2: “H EAVEN ’ S L IGHT IS OUR G UIDE ” R AJSHAHI U NIVERSITY OF E NGINEERING AND T ECHNOLOGY D EPARTMENT OF E LECTRICAL AND E LECTRONIC E NGINEERING

A BRIEF DESCRIPTION OF

8051 MICROCONTROLLE

R

By MD. MOSHIUL ALAM (JONY)ROLL NO. 041016EEE - 4/7, RUET.Mobile No. +8801710998670E-mail:[email protected]

Page 3: “H EAVEN ’ S L IGHT IS OUR G UIDE ” R AJSHAHI U NIVERSITY OF E NGINEERING AND T ECHNOLOGY D EPARTMENT OF E LECTRICAL AND E LECTRONIC E NGINEERING

WHAT IS A MICROCONTROLLER?

Simply say, it is a small computer.We know that a

computer is a machine which is

used for mathematical and logical operation.

It consists of various components such as a

microprocessor, a RAM, ROM, Hard disk, various peripheral devices. All

the devices are set up in a broad named as

motherboard.

Where as a microcontroller is a single chip which

include all the things of a

computer but limited number of

capacity.

Page 4: “H EAVEN ’ S L IGHT IS OUR G UIDE ” R AJSHAHI U NIVERSITY OF E NGINEERING AND T ECHNOLOGY D EPARTMENT OF E LECTRICAL AND E LECTRONIC E NGINEERING

IS THEIR ANY SIMILARITY BETWEEN A MICROPROCESSOR AND A MICROCONTROLLER

No there is not.A microprocessor is a part of the microcontroller.

A microprocessor can’t operate without RAM, ROM and other peripheral devices.

Page 5: “H EAVEN ’ S L IGHT IS OUR G UIDE ” R AJSHAHI U NIVERSITY OF E NGINEERING AND T ECHNOLOGY D EPARTMENT OF E LECTRICAL AND E LECTRONIC E NGINEERING

CONSIDER A MICROCONTROLLER OF ATMEL, AT89C51ED2

Features Compatible with MCS-51 Products4K Bytes of In-System Reprogrammable Flash MemoryFully Static Operation: 0 Hz to 24 MHzThree-level Program Memory Lock128 x 8-bit Internal RAM32 Programmable I/O LinesTwo 16-bit Timer/CountersSix Interrupt SourcesProgrammable Serial ChannelLow-power Idle and Power-down Modes40-pin DIP

Page 6: “H EAVEN ’ S L IGHT IS OUR G UIDE ” R AJSHAHI U NIVERSITY OF E NGINEERING AND T ECHNOLOGY D EPARTMENT OF E LECTRICAL AND E LECTRONIC E NGINEERING

Pin Description

1 – 8 P1.0 – P1.7 – Port 1

9 RST – Reset

10 – 17

P3.0 – P3.7 – Port 3

18 XTAL2 – Crystal

19 XTAL1 – Crystal

20 GND - Ground

21 – 28

P2.0 – P2.7 – Port 2

29 PSEN – Program Store Enable

30 ALE – Address Latch Enable

31 EA – External Access Enable

32 – 39

P0.7 – P0.0 – Port 0

40 Vcc - Positive Power Supply

Page 7: “H EAVEN ’ S L IGHT IS OUR G UIDE ” R AJSHAHI U NIVERSITY OF E NGINEERING AND T ECHNOLOGY D EPARTMENT OF E LECTRICAL AND E LECTRONIC E NGINEERING

NOW TO OPERATE THE CHIP AS A MICROCONTROLLER WE HAVE TO WRITE A C++ PROGRAM. VARIOUS COMPANY RELEASE THEIR OWN C COMPILLER.

In our project we used the

Keil Compiler.First we write the program and run it on

Keil and check that any error is

their.

Keil converts the C program to Hex file

because MC recognize only

Machine Language.If there is no error then we burn it to the

Chip via RS232 Connector.

Page 8: “H EAVEN ’ S L IGHT IS OUR G UIDE ” R AJSHAHI U NIVERSITY OF E NGINEERING AND T ECHNOLOGY D EPARTMENT OF E LECTRICAL AND E LECTRONIC E NGINEERING

TO PERFORM THE TASK, THE MC NEED A SPECIFIC FREQUENCY

The frequency is generally high such as

12MHZ

This frequency is applied to the 18 & 19

pins.

The MC divides the supply frequency by

12.

For various mathematical and logical operation MC needs

certain no. of execution cycle.

It always operate on 5V. Only recognizes 0

(0V) and 1 (5V).

Page 9: “H EAVEN ’ S L IGHT IS OUR G UIDE ” R AJSHAHI U NIVERSITY OF E NGINEERING AND T ECHNOLOGY D EPARTMENT OF E LECTRICAL AND E LECTRONIC E NGINEERING

NOW CONSIDER A PRACTICAL PROBLEM FOR THE USE OF OUR MICROCONTROLLER

Suppose we want to automate the light of our house. If the natural light is reduces then the microcontroller switch on the light.The light sensor can be done by using the LDR (Light dependent resistor)

Page 10: “H EAVEN ’ S L IGHT IS OUR G UIDE ” R AJSHAHI U NIVERSITY OF E NGINEERING AND T ECHNOLOGY D EPARTMENT OF E LECTRICAL AND E LECTRONIC E NGINEERING

HERE IS THE A SIMPLE CIRCUIT FOR THE LIGHT SENSOR:

The above circuit is a light sensor. When light intensity is low then LDR provide about 10K resistance thus the voltage at pin 2 is low ( 4.7*5/(10+4.7)=1.6 and the voltage at the pin 3 (2.5V) is high since the

constant voltage is supplied to the two voltage dividing path. Thus we get 5V at the output. Similarly

when there is sufficient light then the LDR provide about 3K resistance and the voltage at pin 2 is high

then the pin 3. Thus output is 0V. (5*4.7/(3+4.7))=3.05

Page 11: “H EAVEN ’ S L IGHT IS OUR G UIDE ” R AJSHAHI U NIVERSITY OF E NGINEERING AND T ECHNOLOGY D EPARTMENT OF E LECTRICAL AND E LECTRONIC E NGINEERING

NOW IF WE CONNECT THE PREVIOUS CIRCUIT OUTPUT TO P1.1 PORT AND THE LIGHT SWITCH IS CONTROLLED BY THE MOSFET WHOSE GATE IS CONNECTED TO THE P2.1 AND WRITING THE FOLLOWING PROGRAM :

#include <reg51.h> //Header file declaration for 8051 mc

sbit sensor=P1.2; //single bit declaration of P1 port

sbit light=P2.1; //single bit declaration of P2 port

Void main(void)

{

while(1) //infinite loop declaration

{

if(sensor==1)

light=1;

else

light=0;

}

}

Page 12: “H EAVEN ’ S L IGHT IS OUR G UIDE ” R AJSHAHI U NIVERSITY OF E NGINEERING AND T ECHNOLOGY D EPARTMENT OF E LECTRICAL AND E LECTRONIC E NGINEERING

Here is the actual circuit

8051 MC

N.B . To operate the above circuit, ISP(in system programming) board is requied.

Page 13: “H EAVEN ’ S L IGHT IS OUR G UIDE ” R AJSHAHI U NIVERSITY OF E NGINEERING AND T ECHNOLOGY D EPARTMENT OF E LECTRICAL AND E LECTRONIC E NGINEERING

MY BELIEFS

Always thought positive. Never, never and never take

negative as a reference.A Candle don’t loose its light by spreading

its light farther.A man always learn through

mistakes.Every man should believe in his region and the life which comes

after the death.How you can believe that a tiny electron pass through a wire if you don’t believe your creator.

Because both are not seen.

Page 14: “H EAVEN ’ S L IGHT IS OUR G UIDE ” R AJSHAHI U NIVERSITY OF E NGINEERING AND T ECHNOLOGY D EPARTMENT OF E LECTRICAL AND E LECTRONIC E NGINEERING

THANKS YOU