0
3.1kviews
Write an assembly language program for 8051 to generate a delay of 1usec using 12 MHz crystal.

Subject : Microcontroller and Embedded Programming

Topic : Asynchronous Serial Data Connection

Difficulty : Medium

1 Answer
0
268views

Crystal frequency - 12 MHz

T = 12/ 12 X 106 = 1 μsec

Delay period = 1 μsec

Hence a delay of 1msc is required

We will require mode 2 and execute a delay of (lets say) 250 μsec four times.

Suppose we use timer 1 ,

TMOD = 20H

TH = TL1 = (256)$_{10}$ - (250)$_{10}$ = (6)$_{10}$ = (6)$_{16}$

The ISR should toggle a port pin of 8051

enter image description here

Please log in to add an answer.