Skip to content

Instantly share code, notes, and snippets.

@raghavendrahassy
Created June 15, 2016 12:22
Show Gist options
  • Save raghavendrahassy/ee9638f08b67bc6aee9337e6d43f5c29 to your computer and use it in GitHub Desktop.
Save raghavendrahassy/ee9638f08b67bc6aee9337e6d43f5c29 to your computer and use it in GitHub Desktop.
LED Blinking with 8051 Starter Board
#include <reg51.h>
#define LED P3 // LED's are connected to higher bits of P3
void DELAY_ms(unsigned int ms_Count)
{
unsigned int i,j;
for(i=0;i<ms_Count;i++)
{
for(j=0;j<100;j++);
}
}
int main()
{
P3 = (0xf0<<LED); // Configure PORT3.4 to PORT.7 as output
while(1)
{
P3 = (0xf0<<LED); // Turn ON Led's connected to P3
DELAY_ms(1000); // Wait for some time
P3 = (0x00<<LED); // Turn OFF Led connected to P3
DELAY_ms(1000); // Wait for some time
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment