hongwai.c

来自「QH_MCU_V1.1单片机C源码. 内含实验程序 这是修改版.」· C语言 代码 · 共 50 行

C
50
字号
#include <REG51.H>
#include <sys.h>
#include <intrins.h>

unsigned char	LedCode[]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F,0x77,0x7C,0x39,0X5E,0x79,0x71};


sbit  hw = P3^4;

void delay ();



void main()
{
    uchar i;
    P2 = 0x00;
	  P2 = 0x10;
	  P0 = 0x0f;
    P2 = 0x00;
	  P2 = 0x80;
	while(1)
	{

	 if (hw==0)
	  {
	  for(i=0; i<16; i++)
	   {
	    P0=LedCode[i];
			delay ();
			delay ();
	    }	 
       }

	}
}

void delay()
{
    uchar i = 0;
	uchar j = 0;
  for (j=0;j<255;j++)
   {
    for (i=0; i<250; i++)
	  ;
   }
}


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?