led blinking with microcontrolled, Exercises of Engineering

8051 microcontroller with blinking led

Typology: Exercises

2016/2017

Uploaded on 09/19/2017

hamid-ali-1
hamid-ali-1 🇵🇰

1 document

1 / 8

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Blinking 1 LED using 8051
This is the first project regarding 8051 and of course one of the
simplest, blinking LED using 8051. The microcontroller used here
is AT89S51 In the circuit, push button switch S1, capacitor C3 and
resistor R3 forms the reset circuitry. When S1 is pressed, voltage
at the reset pin (pin9) goes high and this resets the chip. C1, C2
and X1 are related to the on chip oscillator which produces the
required clock frequency. P1.0 (pin1) is selected as the output pin.
When P1.o goes high the transistor Q1 is forward biased and LED
goes ON. When P1.0 goes low the transistor goes to cut off and
the LED extinguishes. The transistor driver circuit for the LED can
be avoided and the LED can be connected directly to the P1.0 pin
with a series current limiting resistor(~1K). The time for which
P1.o goes high and low (time period of the LED) is determined by
the program. The circuit diagram for blinking 1 LED is shown
below.
pf3
pf4
pf5
pf8

Partial preview of the text

Download led blinking with microcontrolled and more Exercises Engineering in PDF only on Docsity!

Blinking 1 LED using 8051

This is the first project regarding 8051 and of course one of the

simplest, blinking LED using 8051. The microcontroller used here

is AT89S51 In the circuit, push button switch S1, capacitor C3 and

resistor R3 forms the reset circuitry. When S1 is pressed, voltage

at the reset pin (pin9) goes high and this resets the chip. C1, C

and X1 are related to the on chip oscillator which produces the

required clock frequency. P1.0 (pin1) is selected as the output pin.

When P1.o goes high the transistor Q1 is forward biased and LED

goes ON. When P1.0 goes low the transistor goes to cut off and

the LED extinguishes. The transistor driver circuit for the LED can

be avoided and the LED can be connected directly to the P1.0 pin

with a series current limiting resistor(~1K). The time for which

P1.o goes high and low (time period of the LED) is determined by

the program. The circuit diagram for blinking 1 LED is shown

below.

START: CPL P1.

ACALL WAIT

SJMP START

WAIT: MOV R4,#05H

WAIT1: MOV R3,#00H

START: CPL P1.

ACALL WAIT

CPL P1.

CPL P1.

ACALL WAIT

CPL P1.

SJMP START

WAIT: MOV R4,#05H

WAIT1: MOV R3,#00H

WAIT2: MOV R2,#00H

WAIT3: DJNZ R2,WAIT

DJNZ R3,WAIT

DJNZ R4,WAIT

RET

Pin No Function Name 1 8 bit input/output port (P 1 ) pins P 1. 2 P 1. 3 P 1. 4 P 1. 5 P 1. 6 P 1. 7 P 1. 8 P 1. 9 Reset pin; Active high Reset 10 Input (receiver) for serial communication

RxD 8 bit input/ output port (P 3 ) pins

P 3.

11 Output (transmitter) for serial communication

TxD P 3.

12 External interrupt 1 Int0 P 3. 13 External interrupt 2 Int1 P 3. 14 Timer1 external input T 0 P 3. 15 Timer2 external input T 1 P 3. 16 Write to external data memory Write P 3. 17 Read from external data memory Read P 3. 18 Quartz crystal oscillator (up to 24 MHz) Crystal 2 19 Crystal 1 20 Ground (0V) Ground 21 8 bit input/output port (P 2 ) pins / High-order address bits when interfacing with external memory

P 2 .0/ A 8

22 P 2 .1/ A 9

23 P 2 .2/ A 10

24 P 2 .3/ A 11

25 P 2 .4/ A 12

26 P 2 .5/ A 13

27 P 2 .6/ A 14

28 P 2 .7/ A 15

29 Program store enable; Read from external program memory PSEN 30 Address Latch Enable ALE Program pulse input during Flash programming Prog 31 External Access Enable; Vcc for internal program executions

EA

Programming enable voltage; 12V (during Flash programming)

Vpp

32 8 bit input/output port (P 0 ) pins

Low-order address bits when interfacing with external memory

P 0 .7/ AD 7

33 P 0 .6/ AD 6

34 P 0 .5/ AD 5

35 P 0 .4/ AD 4

36 P 0 .3/ AD 3

37 P 0 .2/ AD 2

38 P 0 .1/ AD 1

39 P 0 .0/ AD 0

40 Supply voltage; 5V (up to 6.6V) Vcc