From 6d1deaf6ca254c32c1a95a9d511f03b022a245db Mon Sep 17 00:00:00 2001 From: iridiumR Date: Thu, 9 Jun 2022 13:04:45 +0800 Subject: [PATCH] =?UTF-8?q?feat(MCU=E8=AF=BE=E8=AE=BE):=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=97=8B=E8=BD=AC=E7=8A=B6=E6=80=81=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MCU/MCU_REAL_FINAL/draw.c | 65 +++++++++++++++++++++++++++++++++++++++ MCU/MCU_REAL_FINAL/draw.h | 3 +- MCU/MCU_REAL_FINAL/main.c | 7 ++--- MCU/MCU_REAL_FINAL/menu.c | 14 ++++----- 4 files changed, 77 insertions(+), 12 deletions(-) diff --git a/MCU/MCU_REAL_FINAL/draw.c b/MCU/MCU_REAL_FINAL/draw.c index 64d875b..6bcdfaa 100644 --- a/MCU/MCU_REAL_FINAL/draw.c +++ b/MCU/MCU_REAL_FINAL/draw.c @@ -283,4 +283,69 @@ void drawVOID8(unsigned char x, unsigned char y, unsigned char len) P1 = 0x00; write(); } +} + +void placeIMG_ROTATE(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 < 8; j++) + { + RS = 0; + RW = 0; + P1 = 0xb8 + y; + write(); + P1 = 0X40 + x + j; + write(); //页y列x+j + + RS = 1; + RW = 0; + P1 = IMG_ROTATE[j]; + write(); + + } +} + +void placeRIMG_BLOCK(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 < 8; j++) + { + RS = 0; + RW = 0; + P1 = 0xb8 + y; + write(); + P1 = 0X40 + x + j; + write(); //页y列x+j + + RS = 1; + RW = 0; + P1 = IMG_BLOCK[j]; + write(); + } } \ No newline at end of file diff --git a/MCU/MCU_REAL_FINAL/draw.h b/MCU/MCU_REAL_FINAL/draw.h index 545cc46..4b3d569 100644 --- a/MCU/MCU_REAL_FINAL/draw.h +++ b/MCU/MCU_REAL_FINAL/draw.h @@ -17,7 +17,8 @@ void drawGOOD(unsigned char x, unsigned char y); void drawGAME(unsigned char x, unsigned char y); void drawOVER(unsigned char x, unsigned char y); void drawBLOCKSCORE(); - +void placeIMG_ROTATE(unsigned char x, unsigned char y); +void placeRIMG_BLOCK(unsigned char x, unsigned char y); ////=================== 记录 ================== void drawBEST(unsigned char x, unsigned char y); diff --git a/MCU/MCU_REAL_FINAL/main.c b/MCU/MCU_REAL_FINAL/main.c index 2fd9069..294c8bb 100644 --- a/MCU/MCU_REAL_FINAL/main.c +++ b/MCU/MCU_REAL_FINAL/main.c @@ -3,7 +3,7 @@ //#define WIPE_BEST -#define RELOAD (65535-7535) //定时器填充值(1ms) +#define RELOAD (65535-6535) //定时器填充值(1ms) unsigned char TH, TL; extern Menu *NOW; //菜单指针 @@ -36,15 +36,14 @@ void time() interrupt 1 // EA = 0; TH0 = TH; TL0 = TL0 + TL; - TL0 = TL0 + 23; if(PIN_4 == 0) { - delayms(9); + delayms(6); if(PIN_4 == 0) { opr = confirm; - delayms(20); + delayms(25); } } diff --git a/MCU/MCU_REAL_FINAL/menu.c b/MCU/MCU_REAL_FINAL/menu.c index c1744f7..e2c49d8 100644 --- a/MCU/MCU_REAL_FINAL/menu.c +++ b/MCU/MCU_REAL_FINAL/menu.c @@ -164,17 +164,17 @@ void m_block(struct _menu* this) drawVOID8(70, 4, 40); drawVOID8(70, 6, 32); } - drawVerticalDottedLine(64); - drawBLOCKSCORE(); - drawSUPNUM(70, 2, score / 10000); //绘制分数 + drawVerticalDottedLine(64); //绘制线 + drawBLOCKSCORE(); //绘制字 + drawSUPNUM(70, 2, score / 10000); //绘制分数 drawSUPNUM(79, 2, (score % 10000) / 1000); drawSUPNUM(88, 2, (score % 1000) / 100); drawSUPNUM(97, 2, (score % 100) / 10); drawSUPNUM(106, 2, score % 10); -// if(local[2]) -// placeIMG_ROTATE(115, 6); -// else -// placeRIMG_BLOCK(115, 6); + if(local[2]) + placeIMG_ROTATE(115, 2); //绘制提示符 + else + placeRIMG_BLOCK(115, 2); blockGameOver(); //检查是否游戏结束