This repository has been archived on 2024-01-06. You can view files and clone it, but cannot push or open issues or pull requests.
justhomework/MCU/MCU_1_1/inc.c

47 lines
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;
}