Flashing leds 8051 example

This example was written using Keil UV2, the board in question was a 8051/ARM development board that I purchased from China.

The micro was a STC90C516RD+

The LEDs are connected to Port 2.

Code

#include<reg52.h>

void Delay(unsigned int t);

sbit LED0=P2^0;
sbit LED1=P2^1;
sbit LED2=P2^2;
sbit LED3=P2^3;
sbit LED4=P2^4;
sbit LED5=P2^5;
sbit LED6=P2^6;
sbit LED7=P2^7;
void main (void)
{

while (1)
{
LED0=0;
LED1=1;
LED2=0;
LED3=1;
LED4=0;
LED5=1;
LED6=0;
LED7=1;
Delay(30000);
LED0=1;
LED1=0;
LED2=1;
LED3=0;
LED4=1;
LED5=0;
LED6=1;
LED7=0;
Delay(30000);
}
}

void Delay(unsigned int t)
{
while(–t);
}

 

Links

Here is the development kit in question, its an excellent kit for the price

51 Development MCU + STM32 ARM Cortex-M3 SCM Development Board – $53.88

from: DealExtreme

Related posts

8051 and RGB led example using the SiLabs IDE

C8051F340 flashing led example

8051 7 Segment display program written in Basic