0% found this document useful (0 votes)
47 views5 pages

Lab Task 09 (Frequency 2500 HZ)

The document is a lab report for an Introduction to Mechatronics course. The objective of the lab was to generate a frequency of 2500 Hz using an AT89C51 microcontroller development board. Timers and the TMOD register were used to create the necessary delays. A C program was written to generate the frequency on pin P2.7 using Timer 1 in mode 2, but the results and conclusions were not included.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views5 pages

Lab Task 09 (Frequency 2500 HZ)

The document is a lab report for an Introduction to Mechatronics course. The objective of the lab was to generate a frequency of 2500 Hz using an AT89C51 microcontroller development board. Timers and the TMOD register were used to create the necessary delays. A C program was written to generate the frequency on pin P2.7 using Timer 1 in mode 2, but the results and conclusions were not included.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Course Code and Name: Introduction to

Mechatronics Lab (ME-332L) Date:

Lab No: 09 Course Instructor: Engr. Zia Ur Rahman

Name of Student: Semester: 6th

Registration No: Department: Mechanical Engineering

Lab Task To generate a frequency of 2500 Hz

1. To learn how to generate a frequency


Objectives 2. To learn how to generate delays using TMOD
3. To familiar with TMOD and how it works

 STC AT89C51 Microcontroller


 Development Board
 Keil µ vision IDE
Hardware
 Prog-ISP
and Software  Wires
Requirements  LEDs
 Oscilloscope
 Proteus

Theory Microcontroller:
A microcontroller is a compact integrated circuit designed to govern a specific operation in
an embedded system. A typical microcontroller includes a processor, memory and input/output
(I/O) peripherals on a single chip.

Microcontroller 8051:
8051 microcontrollers are designed by Intel in 1981. It is an 8-bit microcontroller. It is built with
40 pins DIP (dual inline package), 4kb of ROM storage and 128 bytes of RAM storage, 2 16-bit
timers. It consists of are four parallel 8-bit ports, which are programmable as well as addressable
as per the requirement. An on-chip crystal oscillator is integrated in the microcontroller having
crystal frequency of 12 MHz.

Prepared by Tanveer Uz Zaman


TMOD:
Both timers 0 and 1 use the same register, called TMOD (timer mode), to set the various timer
operation modes. The lower 4 bits are for Timer 0 The upper 4 bits are for Timer 1 In each case,
the lower 2 bits are used to set the timer mode. The upper 2 bits to specify the operation.

Fig. Operating Mode

Prepared by Tanveer Uz Zaman


Diagram:

Fig. Development Board with AT89C51 Microcontroller

Procedure  The hardware way of starting and stopping the timer by an external source is
achieved by making GATE=1 in the TMOD register
 Load the TMOD value register indicating which timer (timer 0 or timer 1) is to be
used, and the timer mode (mode 2) is selected
 Load the TH registers with the initial count value
 Start timer
 Keep monitoring the timer flag (TF) with the JNB TFx, target instruction to see
whether it is raised
 Get out of the loop when TF goes high
 Clear the TF flag
 Go back to Step4, since mode 2 is auto-reload

Prepared by Tanveer Uz Zaman


Connection Diagram:

Fig. Connection Diagram

Prepared by Tanveer Uz Zaman


Programming Write an 8051 C program to create a frequency of 2500 Hz on pin P2.7. Use Timer 1,
Code mode 2 to create delay.

Results and
Conclusions

Prepared by Tanveer Uz Zaman

You might also like