47 lines
No EOL
595 B
C
47 lines
No EOL
595 B
C
#include <reg52.h>
|
|
#include "inc.h"
|
|
#include <intrins.h>
|
|
static void shortdelay()
|
|
|
|
{
|
|
int i;
|
|
for(i = 50; i > 0; i--);
|
|
}
|
|
|
|
|
|
static void longdelay()
|
|
|
|
{
|
|
int i;
|
|
for(i = 300; i > 0; i--);
|
|
}
|
|
const unsigned char hello_var[] = {0x91, 0x61, 0xe3, 0xe3, 0x03};
|
|
|
|
static void hello()
|
|
{
|
|
int i=0;
|
|
unsigned char var2 = 0x10;
|
|
for(;i<=5;i++)
|
|
{
|
|
P0 = ~var2;
|
|
P2 = hello_var[4-i];
|
|
shortdelay();
|
|
P0 = 0XFF;
|
|
longdelay();
|
|
var2=var2>>1;
|
|
}
|
|
}
|
|
|
|
void delay(int a)
|
|
{
|
|
unsigned char i;
|
|
for(; a > 0; a--)
|
|
for(i = 18; i > 0; i--)
|
|
hello()
|
|
;
|
|
}
|
|
void ledfull()
|
|
{
|
|
P2 = 0xff;
|
|
P0 = 0X00;
|
|
} |