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

#Include "E:/Keil/C51/INC/Intel/reg51f.h" #Include "Isd51.h" Void Delay (Void)

This program uses an 8051 microcontroller to blink LEDs connected to port P2 in a repeating pattern. It initializes the timer 1 module and serial port for asynchronous communication, loads the timer 1 register, enables interrupts and the timer, then enters a forever loop that sets P2 to different patterns (0x07, 0x0b, 0x0d, 0x0e) with delays in between using a for loop counter in the delay function.

Uploaded by

Kiran Somayaji
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views

#Include "E:/Keil/C51/INC/Intel/reg51f.h" #Include "Isd51.h" Void Delay (Void)

This program uses an 8051 microcontroller to blink LEDs connected to port P2 in a repeating pattern. It initializes the timer 1 module and serial port for asynchronous communication, loads the timer 1 register, enables interrupts and the timer, then enters a forever loop that sets P2 to different patterns (0x07, 0x0b, 0x0d, 0x0e) with delays in between using a for loop counter in the delay function.

Uploaded by

Kiran Somayaji
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

#include "E:\Keil\C51\INC\Intel\reg51f.

h"
#include "isd51.h"
void delay(void);

void main(void)
{
TMOD |= 0x20;
TCON = 0;
TH1 = 0xfd;
SCON = 0x50;
TR1 = 1;
EA = 1;

ISDwait();

while(1)
{
P2=0x07;
delay();

P2=0x0b;
delay();

P2=0x0d;
delay();

P2=0x0e;
delay();

}
}
void delay(void)
{
int i;
for(i=0;i<=30000;i++);
}

You might also like