?? main.c
字號:
#include "reg52.h"
#include "def.h"
#include "absacc.h"
#include "DISPLAY.h"
//#include "key.h"
#include "eep16.h"
sbit key_1=P1^0 ;
sbit key_2=P1^1 ;
sbit key_3=P1^2 ;
sbit key_4=P1^3;
//uchar code single[10]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
// uchar code single_point[9]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f,0xff};
uchar led_0=0,led_1=0,led_2=0,led_3=0,led_display=0;
uchar idata read_buff[12]=0;
uchar q=0,p=0,write_buff[12]={0,1,2,3,9,8,4,2,2,1,10,11};
//uchar light1_0=0,light1_1=0,light2_0=0,light2_1=0,light3_0=0,light3_1=0;
void time_again(int t)
{
int i;
while(t--)
for(i=0;i<5;i++)
display(read_buff[q],q,write_buff[p],p);
}
void key_function(void)
{
if((P1&0x0f)!=0x0f)
{
time_again(10);
if(key_1==0)
{
if(p==9)
{
CAT24C16Write( &write_buff[p],p,1);
p=0;}
else{
CAT24C16Write( &write_buff[p],p,1);
p++;}
}
if(key_2==0)
{
q++;
if(q>9)
{
q=0;
CAT24C16Read( &read_buff[q],q,1);
}
else
CAT24C16Read( &read_buff[q],q,1);
}
if(key_3==0)
{
uchar nothing[10]=0;
CAT24C16Write( nothing,0,10);
q=0;
p=0;
read_buff[10]=0;
}
if(key_4==0)
{
}
}
while((P1&0x0f)!=0x0f)display(read_buff[q],q,write_buff[p],p);
}
void main(void)
{
while(1)
{key_function();
display(read_buff[q],q,write_buff[p],p);
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -