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

Lab 9B Counting Pulses: Lab Manual For "The 8051 Microcontroller .."

The document provides instructions for an experiment using an 8051 microcontroller to count pulses from an external square wave generator. Students will program timer/counter 0 to count up from 0 to 255 as each 1 Hz pulse is fed into pin P3.4 of the 8051. The count will be displayed in binary on the LEDs of the 8051 trainer. The objectives are to program the 8051 timer/counter as an event counter and notice that the binary display counts from 00000000 to 11111111, representing values from 0 to 255 in decimal.
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Lab 9B Counting Pulses: Lab Manual For "The 8051 Microcontroller .."

The document provides instructions for an experiment using an 8051 microcontroller to count pulses from an external square wave generator. Students will program timer/counter 0 to count up from 0 to 255 as each 1 Hz pulse is fed into pin P3.4 of the 8051. The count will be displayed in binary on the LEDs of the 8051 trainer. The objectives are to program the 8051 timer/counter as an event counter and notice that the binary display counts from 00000000 to 11111111, representing values from 0 to 255 in decimal.
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

LAB 9B

COUNTING PULSES
OBJECTIVES:
To program the 8051 timer/counter as an event counter.
.
REFERENCE:
Mazidi and McKinlay, The 8051 Microcontroller ., Chapter 9.
MATERIALS:
MDE8051 Trainer
8051 Keil Compiler
Square wave generator
For this lab you need an external source of the square wave. This can be
from a signal generator (or some call it a function generator).
ACTIVITY 1
Connect the square wave from function generator to pin P3.4 for Timer
0 and set the frequency to 1 Hz. Write and run a program for counter/timer 0
to count up from 00 to a maximum of 255 (FFH) as each pulse is fed into the
8051. The count is displayed in binary on the 8 LEDS of 8051 Trainer. Notice
that the binary numbers displayed for the count goes from 00 to FF
(00000000- 11111111 in binary or 00 -255 in decimal).

Lab Manual for The 8051 Microcontroller ..

LAB 9B
WORKSHEET
Name:

Date:

Class:

1. Explain the role of the C/T bit in the TMOD register.

2. How is the 8051 used as an event counter to count an external event?

3. If timer/counter 0 is used as an event counter, what is the maximum


count for the following
modes?
Mode 1
Mode 2
4. Indicate which pin is used for the following.
(a) timer/counter 0
(b) timer/counter 1
5. If timer/counter 0 is used in mode 1 to count an external event, explain
when TF0 is set to
high.
6. If timer/counter 1 is used in mode 2 to count an external event, explain
when TF0 is set to
high.

Lab Manual for The 8051 Microcontroller ..

You might also like