0% found this document useful (0 votes)
49 views

Lab#09 LAB NAME: Counters in 8051

This document describes Lab 9 which focuses on counters in the 8051 microcontroller. The objectives are to become familiar with counters and how they are used. The lab uses an 8051 microcontroller, LEDs, wires, and Proteus 8 software. The code demonstrates using counter 0 in mod0 mode to count external pulses and display the count on port 2 while toggling an LED. The procedure is to write the assembly code, build the circuit, check for errors, and observe the output on the LED and port 2 as the counter counts pulses.

Uploaded by

farheen khoso
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views

Lab#09 LAB NAME: Counters in 8051

This document describes Lab 9 which focuses on counters in the 8051 microcontroller. The objectives are to become familiar with counters and how they are used. The lab uses an 8051 microcontroller, LEDs, wires, and Proteus 8 software. The code demonstrates using counter 0 in mod0 mode to count external pulses and display the count on port 2 while toggling an LED. The procedure is to write the assembly code, build the circuit, check for errors, and observe the output on the LED and port 2 as the counter counts pulses.

Uploaded by

farheen khoso
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Microcontroller and Microprocessor lab 9

Lab#09
LAB NAME: Counters In 8051
9.1 Lab 0bjective: To become familiar with counters how they are used in 8051
9.2 Pre lab reading:
Book: the 8051 microcontroller and embedded systems, edition second, author Muhammad
Ali mazidi, chapter 09, and topic: delay program
9.3 Equipment:
Proteus 8, power supply
9.4 Components:
8051 microcontroller, led, wires,
9.5 Circuit:

9.6 Code:
ORG 00H
main:
MOV TMOD, #60H
MOV TH1,#0H
SETB P3.5
AGAIN: SETB TR1
HERE: MOV A,TL1
MOV P2, A
JNB TF1, HERE

1
21395
Microcontroller and Microprocessor lab 9

CLR TF0
SJMP AGAIN
End

9.7 Output:

9.8 Exercise/procedure:
Open the software for the simulation. Go for the new project and select the controller. Now
write the program for timer in assembly. 8051 has two timer (timer0.timer) but here we used
timer0 for our simulation. But here we have used counter instead of timer. Counter0 is used
for the counter operation. After completing the code and circuit now check the errors if any
then fix it and run it
Mod0 is of 13-bit and mod1 is of 16-bit and the mod2 is 8-bit auto reload.
Code the counter0 for mod0 run the simulation and observe the result. Repeat the procedure
for mod1 and mod2.
9.9 Notes:
We can use timers 0 and 1 as event counters. A timer can be used as a counter if we provide
pulses from outside the chip instead of using the frequency of the crystal oscillator as the
clock source. By feeding pulses to the TO (P3.4) and Tl (P3.5) pins, we turn Timer 0 and
Timer 1 into counter 0 and counter 1.

2
21395
Microcontroller and Microprocessor lab 9

9.10 Assessment sheet:


CMS ID: 21395
DATE: 29-06-2015

1-counters in 8051
Problem Number 2-using counter for event
count
Working
Lab Performance
Viva

Total Score in Lab#9

Instructor's Verification

3
21395

You might also like