Assignment- 06
CSE 331
Microprocessor Interfacing and Embedded System
Section 01
Summer 2020
North South University
Submitted To: Dr. Dihan Md. Nuruddin Hasan (dmh)
Name : Sazid Khandaker
Student ID : 1520347642
1. Write the embedded C code for 8051 to produce the following timing diagram. Use timer.
Assume a 8051 clock frequency of 11 MHz [10]
Ans: Here is the embedded C code,
#include <REG51.h>
sbit portbit = P1^0;
void delay();
void delay ()
{
TMOD =0x1;
TH0=0x2A;
TL0=0x9E;
TR0=1;
while (TF0 !=1 )
{
;
}
}
void main()
{
portbit =0;
while(1)
{
delay();
portbit =1;
delay();
delay();
portbit =0;
}
}