fix(MCU课设): 似乎是函数太多了,现在至少是好的

This commit is contained in:
iridiumR 2022-06-06 21:31:46 +08:00
parent 5873aa5ba2
commit e800cbf2aa
5 changed files with 104 additions and 99 deletions

View file

@ -188,7 +188,7 @@
<Target51Misc>
<MemoryModel>2</MemoryModel>
<RTOS>0</RTOS>
<RomSize>2</RomSize>
<RomSize>1</RomSize>
<DataHold>0</DataHold>
<XDataHold>0</XDataHold>
<UseOnchipRom>0</UseOnchipRom>

View file

@ -69,48 +69,7 @@ void clear()
}
void miniclear()
{
unsigned int i, j;
CSA = 1;
CSB = 0;
for(i = 0; i < 2; i++)
{
RS = 0;
RW = 0;
P1 = 0xb8 + i;
write();
P1 = 0X40;
write();
for(j = 0; j < 64; j++)
{
RS = 1;
RW = 0;
P1 = 0x00;;
write();
}
}
CSA = 0;
CSB = 1;
for(i = 0; i < 2; i++)
{
RS = 0;
RW = 0;
P1 = 0xb8 + i;
write();
P1 = 0X40;
write();
for(j = 0; j < 64; j++)
{
RS = 1;
RW = 0;
P1 = 0x00;
write();
}
}
}
void displayInit()
{
E = 0;
@ -127,46 +86,3 @@ void displayInit()
P1 = 0X3F;
write();
}
void test()
{
unsigned int i, j;
CSA = 1;
CSB = 0;
for(i = 0; i < 8; i++)
{
RS = 0;
RW = 0;
P1 = 0xb8 + i;
write();
P1 = 0X40;
write();
for(j = 0; j < 64; j++)
{
RS = 1;
RW = 0;
P1 = 0x55;
write();
}
}
CSA = 0;
CSB = 1;
for(i = 0; i < 8; i++)
{
RS = 0;
RW = 0;
P1 = 0xb8 + i;
write();
P1 = 0X40;
write();
for(j = 0; j < 64; j++)
{
RS = 1;
RW = 0;
P1 = 0x55;;
write();
}
}
}

View file

@ -1,16 +1,8 @@
#ifndef _DISPLAY_H_
#define _DISPLAY_H_
void setData(unsigned char d);
void setCommand(unsigned char d);
void lcdInit();
void setPage(unsigned char p);
void setPage(unsigned char p);
void setLine(unsigned char p);
void setY(unsigned char p);
void test();
void displayInit();
void clear();
void miniclear();
void write();
#endif

View file

@ -570,4 +570,92 @@ void drawVOID8(unsigned char x,unsigned char y,unsigned char len)
P1 = 0x00;
write();
}
}
void drawBEST(unsigned char x, unsigned char y)
{
unsigned int j;
if(x < 0 || x > 127)
return;
else if(x < 64)
{
CSA = 1;
CSB = 0;
}
else
{
x = x - 63;
CSA = 0;
CSB = 1;
}
for(j = 0; j < 40; j++)
{
RS = 0;
RW = 0;
P1 = 0xb8 + y;
write();
P1 = 0X40 + x + j;
write(); //Ò³yÁÐx+j
RS = 1;
RW = 0;
P1 = FONT_BEST0[j];
write();
RS = 0;
RW = 0;
P1 = 0xb8 + y + 1;
write();
P1 = 0X40 + x + j;
write(); //Ò³y+1ÁÐx+j
RS = 1;
RW = 0;
P1 = FONT_BEST1[j];
write();
}
}
void drawRECORD(unsigned char x, unsigned char y)
{
unsigned int j;
if(x < 0 || x > 127)
return;
else if(x < 64)
{
CSA = 1;
CSB = 0;
}
else
{
x = x - 63;
CSA = 0;
CSB = 1;
}
for(j = 0; j < 32; j++)
{
RS = 0;
RW = 0;
P1 = 0xb8 + y;
write();
P1 = 0X40 + x + j;
write(); //Ò³yÁÐx+j
RS = 1;
RW = 0;
P1 =MAINMANU_PAGE4[j];
write();
RS = 0;
RW = 0;
P1 = 0xb8 + y + 1;
write();
P1 = 0X40 + x + j;
write(); //Ò³y+1ÁÐx+j
RS = 1;
RW = 0;
P1 = MAINMANU_PAGE5[j];
write();
}
}

View file

@ -67,14 +67,14 @@ code unsigned char MAINMANU_PAGE3[]={
0x00,0x80,0x40,0x20,0x18,0x07,0x00,0x00,0x40,0x80,0x40,0x3F,0x00,0x00,0x00,0x00,
0x10,0x30,0x10,0x0F,0x88,0x48,0x21,0x11,0x0D,0x03,0x0D,0x11,0x21,0x41,0x81,0x00,
};
//第三行:弹球
//µÚÈýÐУº¼Ç¼
code unsigned char MAINMANU_PAGE4[]={
0x02,0xE2,0x22,0x22,0x3E,0x00,0x00,0xF9,0x4A,0x4C,0xF8,0x4C,0x4A,0xF9,0x00,0x00,
0x04,0x84,0x84,0xFC,0x84,0x84,0x10,0x50,0x90,0x10,0xFF,0x90,0x11,0x16,0x90,0x00,
0x40,0x40,0x42,0xCC,0x00,0x00,0x00,0x84,0x84,0x84,0x84,0x84,0xFC,0x00,0x00,0x00,
0x80,0x80,0x82,0x92,0x92,0x92,0x92,0x92,0x92,0x92,0x92,0xFE,0x80,0x80,0x80,0x00,
};
code unsigned char MAINMANU_PAGE5[]={
0x00,0x43,0x82,0x42,0x3E,0x00,0x10,0x13,0x12,0x12,0xFF,0x12,0x12,0x13,0x10,0x00,
0x20,0x60,0x20,0x1F,0x10,0x10,0x10,0x08,0x45,0x82,0x7F,0x01,0x06,0x09,0x10,0x00,
0x00,0x00,0x00,0x7F,0x20,0x10,0x00,0x3F,0x40,0x40,0x40,0x40,0x41,0x40,0x70,0x00,
0x40,0x40,0x22,0x24,0x10,0x48,0x80,0x7F,0x04,0x08,0x18,0x24,0x22,0x40,0x40,0x00,
};
//第四行:关于
code unsigned char MAINMANU_PAGE6[]={
@ -163,4 +163,13 @@ code unsigned char FONT_OVER1[]={
0x20,0x3F,0x20,0x20,0x23,0x20,0x18,0x00,
0x20,0x3F,0x20,0x00,0x03,0x0C,0x30,0x20,
};
//=================== ¼Ç¼×Ö¿â ==================
code unsigned char FONT_BEST0[]={
0x40,0x40,0xC0,0x5F,0x55,0x55,0xD5,0x55,0x55,0x55,0x55,0x5F,0x40,0x40,0x40,0x00,
0x04,0x04,0x04,0x04,0xF4,0x94,0x95,0x96,0x94,0x94,0xF4,0x04,0x04,0x04,0x04,0x00,
};
code unsigned char FONT_BEST1[]={
0x20,0x60,0x3F,0x25,0x15,0x15,0xFF,0x90,0x47,0x29,0x11,0x2D,0x43,0x80,0x80,0x00,
0x00,0xFE,0x02,0x02,0x7A,0x4A,0x4A,0x4A,0x4A,0x4A,0x7A,0x02,0x82,0xFE,0x00,0x00,
};
#endif