0% found this document useful (0 votes)
69 views4 pages

LAB NAME: Programming in Mode (0, 1, 2)

This document describes a microcontroller lab experiment on programming timers in different modes. The objectives are to get familiar with using modes 0, 1, and 2 in assembly language. The lab uses an 8051 microcontroller, LED, wires, and power supply. Code is provided to program timer 0 in each mode - mode 0 is 13-bit, mode 1 is 16-bit, and mode 2 is 8-bit auto-reload. Students open the simulation software, write the timer programs, build the circuit, check for errors, run the simulations, and observe the results for each mode.

Uploaded by

farheen khoso
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
69 views4 pages

LAB NAME: Programming in Mode (0, 1, 2)

This document describes a microcontroller lab experiment on programming timers in different modes. The objectives are to get familiar with using modes 0, 1, and 2 in assembly language. The lab uses an 8051 microcontroller, LED, wires, and power supply. Code is provided to program timer 0 in each mode - mode 0 is 13-bit, mode 1 is 16-bit, and mode 2 is 8-bit auto-reload. Students open the simulation software, write the timer programs, build the circuit, check for errors, run the simulations, and observe the results for each mode.

Uploaded by

farheen khoso
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Microcontroller and Microprocessor lab 8

Lab#08
LAB NAME: Programming in Mode (0, 1, 2)
8.1 Lab 0bjective:
To become familiar how to use modes in assembly language
8.2 Pre lab reading:
Book: the 8051 microcontroller and embedded systems, edition second, Author Muhammad
Ali mazidi, chapter 09, and topic: delay program
8.3 Equipment:
Proteus 8, power supply
8.4 Components:
8051 microcontroller, led, wires,
8.5 Circuit:

8.6 Code:
FOR TIMER0 MOD0
ORG 00H
MAIN:
MOV TMOD, 00H
HERE: MOV TL0, #15H
MOV TH0, #0FFH
CPL P1.0

1
21395
Microcontroller and Microprocessor lab 8

SETB TR0
JNB TF0, $
CLR TR0
CLR TF0
SJMP HERE
END
FOR TIMER0 MOD 1
ORG 00H
MAIN:
MOV TMOD, 01H
HERE: MOV TL0,#0F5H
MOV TH0,#0FFH
CPL P1.0
SETB TR0
JNB TF0, $
CLR TR0
CLR TF0
SJMP HERE
End
FOR TIMER0 MOD 2
ORG 00H
main:
MOV TMOD, 02H
MOV TH0, #0FDH
HERE: CPL P1.0
SETB TR0
JNB TF0, $
CLR TF0
SJMP HERE
End

2
21395
Microcontroller and Microprocessor lab 8

8.7 Output:

8.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. 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.
Select the components from library and drag it on the screen and connect them together
Code the timer0 for mod0 run the simulation and observe the result. Repeat the procedure for
mod1 and mod2.
8.9 Notes:
8051 has two timers which are used for the timer and a counter. .

3
21395
Microcontroller and Microprocessor lab 8

8.10 Assessment sheet:


CMS ID: 21395
DATE: 22-06-2015

1-programming mode
Problem Number 2-using timers for mode
0,1,2
Working
Lab Performance
Viva

Total Score in Lab#8

Instructor's Verification

4
21395

You might also like