C语言用Keil C51写的,源码如下:
#include <reg51.h>
#define uint unsigned int
sbit led1 = P1^7;
void delay1s ();
int main (void)
{
while (1)
{
P1 =0xff; delay1s ();
P1 =0x7f; delay1s();
}
}
void delay1s()
{
uint i, j;
for (i = 500; i > 0; i--)
for (j = 110; j > 0; j--);
} |