本帖最后由 smzcky 于 2016-12-20 16:50 编辑
#include "led.h"
#include "delay.h"
#include "sys.h"
#include "usart.h"
#include "lcd.h"
#include "key.h"
int main(void)
{
u8 lcd_id[12];
delay_init();
uart_init(9600);
LED_Init();
LCD_Init();
KEY_Init();
sprintf((char*)lcd_id,"LCD ID:%04X",lcddev.id);
while(1)
{
BACK_COLOR=WHITE;
POINT_COLOR = BLACK;
LCD_DrawLine(0,0,240,0);
LCD_DrawLine(0,0,0,320);
LCD_DrawLine(240,0,240,320);
LCD_DrawLine(0,80,240,80);
LCD_DrawLine(0,140,180,140);
LCD_DrawLine(0,200,240,200);
LCD_DrawLine(0,260,180,260);
LCD_DrawLine(0,320,240,320);
LCD_DrawLine(60,80,60,320);
LCD_DrawLine(120,80,120,320);
LCD_DrawLine(180,80,180,320);
LCD_ShowString(20,100,360,360,24,"7");
LCD_ShowString(80,100,360,360,24,"8");
LCD_ShowString(140,100,360,360,24,"9");
LCD_ShowString(20,160,360,360,24,"4");
LCD_ShowString(80,160,360,360,24,"5");
LCD_ShowString(140,160,360,360,24,"6");
LCD_ShowString(20,220,360,360,24,"1");
LCD_ShowString(80,220,360,360,24,"2");
LCD_ShowString(140,220,360,360,24,"3");
LCD_ShowString(20,280,360,360,24,"0");
LCD_ShowString(80,280,360,360,24,"*");
LCD_ShowString(140,280,360,360,24,"/");
LCD_ShowString(200,120,360,360,24,"+");
LCD_ShowString(200,240,360,360,24,"-");
}
}
写了半天才画出计算器的基本框架,不知道按键控制的具体函数,按键按下去怎么让它显示在屏幕上具体数字符号上有闪烁之类,还有算法程序,求指教。 |