Professional Documents
Culture Documents
EM TESTED
EM TESTED
Dr. D.G.Vyas
The AT89C52 is a popular 8-bit microcontroller. An This circuit is designed and developed particularly
experimental understanding is presented by few for the educational purpose. By these experiments,
experiments about Input/Output, Counters/Timers the students can understand microcontroller
and Interrupts of microcontroller AT89C52. These fundamentals and its applications. The AT89C52
experiments are designed and developed to has four ports. Here Port-0 and Port-2 are used to
understand the concepts of microcontroller illuminate 6-FNDs and 2-LEDs. Common anode
AT89C52. This novel experiments are useful to type LT542 FNDs are used. The single FND can be
clear the basic doubts of the microcontroller activated by providing low logic on its
AT89C52. The input can be given by the switches. corresponding Port pin of Port-0 and its
Large number of software based experiments can corresponding special code on Port-2. When low
be setup on this hardware. Many projects can also logic is given at the base of PNP transistor BC557
be done on this hardware like, the clock, running through 10KΩ resistor, then the transistor comes
numerical display, stopwatch, blinking display, into saturation. The saturated transistor provides
square wave generator etc. In the present +5 volt at the anode of its corresponding FND.
experimental setup the output can be obtain in the Fig.-2 shows the P.C.B. layout and Fig.-3 shows the
form of Light, Sound and an Electrical waves. The Component Layout. All straight line segments in the
present work is useful particularly for the students overlay layer show the jumper wires in the P.C.B. and
and industrial learners. other shapes show the dimensions of the
components. The pullup resistors are needed for
Introduction port-0. The ladder contains pull-up resistors R6 to
This hardware module is especially designed to R13 of 10KΩ, means all resistors are having same
learn the fundamentals of the AT89C52. The output 10KΩ value. The eight PNP transistors BC 557 (T1
can be seen on FNDs and LEDs. The data can be to T8) are doing switching action to supply +5V at
entered by using four switches. The output light can FNDs, LEDs . Eight current limiting resistors R22 to
be seen on FNDs and LEDs. Many companies like R29 of 220Ω each are used with a buffer IC 74245.
Renesas, Freescale, Atmel, Intel, National, Fig.-2 shows that the same track is not connected
Motorola, Philips, Zilog, etc. are manufacturing with the same segments in two consecutive FNDs.
many models of micro-controllers. The designer The segments are the same for the same track in
can choose the company of the microcontroller and FND-0, FND-2 and FND-4. Similarly, the segments
a model as per the requirement of Port pins, are the same for the same track in FND-1, FND-3
Timer/Counter, RAM, ROM, etc. The cost of the and FND-5. By this logic in P.C.B. drawing, the
system is an important aspect in system design. single sided P.C.B. needs to develop. The Port-2
Software written for some small practical needs to send different data to display the same on
application is enough to get stored in most of these two consecutive FNDs. The Port pins of Port-2 are
microcontrollers. The microcontroller AT89C52 connected with the FND segments through the
has internal EPROM, RAM, Decoder, Ports, Timer buffer IC 74245 and eight 220Ω current limiting
/Counter etc. resistors R22 to R29. The Port pins P2.7, P2.6, P2.5,
Circuit Understanding P2.4, P2.3, P2.2, P2.1 and P2.0 are connected with
The schematic circuit diagram of this experimental FND segments g, f, a, b, h, c, d and e respectively in
hardware module is shown in Fig.-1. The +5 Volt is FND-0, FND-2 and FND-4. Similarly, The Port pins
supplied to this circuit by the external power supply. P2.7, P2.6, P2.5, P2.4, P2.3, P2.2, P2.1 and P2.0
C C1 +5V
R11
R13
R12
R10
R9
R8
R7
R6
R
1 40
P1.0 VCC
2 39
P1.1 P0.0
3 38
P1.2 P0.1
4 P0.2 37
5 P1.3 36
P0.3
6 P1.4 P0.4 35
7 P1.5 P0.5 34
R1 P1.6
8 P0.6 33
R2 9 P1.7 P0.7 32
10 RESET IC1 31
R3 P3.0
11 EA 30
R4 12 P3.1 ALE 29
R21
R20
R14
R19
R18
R17
R16
R15
13 P3.2 PSEN 28
R5
T5
X1
T6
C3 C4
C2 T7
T8
CE GND
19 19
VCC
1 S/R 20
A7 B7 R29
9 11
A6 B6 R28
8 12
A5 IC2 B5 R27
7 13
A4 B4 R26
6 14
A3 B3 R25
5 15
A2 B2 R24
4 16 L1 L0
A1 B1 R23
3 17
A0 B0 R22
2 18
FND5 FND4 FND3 FND2 FND1 FND0
CONSTRUCTION
ORG START
MOV P0,#00H interrupt-0 (by Pressing S2) and display 2 on FND-0
MOV P2,#00H by falling edge triggered interrupt-1 (by Pressing
MOV TL0,#00H
MOV TH0,#00H
S3).
MOV TMOD,#81H
MOV IE,#82H Assembly Code for Experiment-4
MOV R2,#20H
START EQU 1700H
SETB TR0
INT_0 EQU 0003H
HERE:SJMP HERE
INT_1 EQU 0013H
END
I_0 EQU 0100H
I_1 EQU 0200H
ORG 0000H
Experiment-3 JMP START
Develop the program for the decade counter using ORG INT_0
JMP I_0
Timer-0 on FND-0. ORG INT_1
JMP I_1
ORG I_0
Assembly Code for Experiment-3 MOV P2,#0EBH
START EQU 1700H RETI
TIMER_0 EQU 000BH ORG I_1
TI_0 EQU 0100H MOV P2,#4CH
FND024 EQU 0200H RETI
ORG 0000H ORG START
JMP START MOV SP,#30H
ORG TIMER_0 MOV TCON,#04H
JMP TI_0 MOV P0,#00H
ORG TI_0 MOV P2,#00H
INC R2 MOV IE,#85H
CJNE R2,#10H,END_T0 MOV P0,#7FH
MOV R2,#00H MOV P2,#88H
MOV A,R0 HERE: SJMP HERE
MOVC A,@A+DPTR END
MOV P2,A
INC R0
CJNE R0,#0AH,END_T0
MOV R0,#00H
Experiment-5
END_T0: SETB TR0 Develop the program to hear some sound on the
RETI Buzzer.
ORG FND024
DB 88H
DB 0EBH Assembly Code for Experiment-5
DB 4CH ORG 0000H
DB 49H MOV P0,#00H
DB 2BH MOV P2,#00H
DB 19H MOV P0,#0FFH
DB 18H HERE: CPL P0.0
DB 0CBH CALL DELAY
DB 08H SJMP HERE
DB 09H
ORG START DELAY: MOV R0,#0FFH
MOV P0,#00H LOOP1: DJNZ R0,LOOP1
MOV P2,#00H RET
MOV TL0,#00H END
MOV TH0,#00H
MOV TMOD,#81H COMPONENT LIST
MOV IE,#82H SEMICONDUCTOR DEVICES
MOV R0,#00H IC1 At89c52
IC2 74245
MOV R2,#00H FND0 to FND5 Common Anode FNDs LT542
MOV DPTR,#FND024 L0 & L1 Red LEDs
T1 to T8 BC557 PNP Transistors
MOV P0,#7FH
MOV P2,#0FFH CAPACITORS
C 10µf
SETB TR0 C1 & C2- 0.1uf
HERE: C3 & C4- 33pf
SJMP HERE RESISTOR
END R, R1 to R4, R14 to R21 10KΩ
R6 to R13 10KΩ
R5 1KΩ
R22-R29 220 ohm
Experiment-4 MISCELLANEOUS
Develop the program to understand both the X1
Buzzer
12MHZ CRYSTAL
+5 volt operated buzzer
+5 volt/ 1 Amp. D.C. Regulated Power supply
external interrupts. Initially display 0 on FND-0. A Computer with Programmer
T1 e T2 e T3 e T4 e T5 e T6 e T7 e T8
e
R5
R21 R20 R19 R18 R17 R16 R15 R14
C1
+ R6-R13 C2
+5V DC
1
+
C
R22
IC1 R23
R R24
IC2 R25
R1 R26
1 C3 R27
R2 C4 R28
R3 R29
X1
R4 S0 S1 S2 S3