//-------------------------------------------//头文件//-------------------------------------------#include<reg51.h>#include<stdio.h>typedef unsigned char uchar;typedef unsigned char uint;uchar counter=0;sbit key1=P3^2;sbit key2=P3^3;sbit key3=P3^4;sbit key4=P3^5;//---------------------------...
好久没发代码了,最近在学单片机,就写了一些简单的东西,高手见笑了!
#include<reg52.h>#include<stdio.h>unsigned int i=0;typedef unsigned char unchar;unchar Ledinit=0xE7;unchar LedshiftL=0xDF;unchar LedshiftR=0xFB;unchar r=0x01;unchar l=0x80; unchar counter=0;void Init_timer(void){ TMOD=0x22; TH0=TL0=56; TR0=1; ...