第一次嵌入式裸机应用设计——秒表器

运用到lcd,timer,touch触摸屏,uar函数t等

第一次做的一个裸机设计花了一天半左右的时间,顺便重新温习了前面裸机程序的知识。从lcd,timer计时器,touch触摸屏,uart中断这四个方面着手,以下是第一次实现功能的程序,还需要后期的一些优化,如触摸屏校准,led亮灯,按键图片的切换等等。微笑微笑



main主函数,打印图片和字

#include"lcd.h"
#include"timer.h"
#include "def.h"
#include"uart.h"
#include"touch.h"
int Main()
{
   
	int a=0,b=0,c=0,d=0,f=0,g=0,h=0;
	//Lcd_ClearScr(0xffffff);
	Uart0_Init(115200) ;
	touch_init();
   lcd_Init(); 
   Timer0_Init();
   paint_pic(gImage_test);
   Draw_Text16(300,100,0xff00ff,test0);
   Draw_Text16(280,100,0xff00ff,test0);
   Draw_Text16(260,100,0xff00ff,test0);
   Draw_Text16(240,100,0xff00ff,test0);
   Draw_Text16(220,100,0xff00ff,test0);
   Draw_Text16(200,100,0xff00ff,test0);
	while(1)
	{	
		//paint_line(10,100,10,250, 0xffff00);
		//paint_line(50,100,50,250, 0xff00ff);
		//paint_line(100,100,100,250, 0x00ffff);
		Draw_Text16(234,100,0xff00ff,testn);
		Draw_Text16(274,100,0xff00ff,testn);
		Draw_Text16(5,10,0xff00ff,han1);
		//Lcd_ClearScr1(15,50,16,16,0xfff00);
		Draw_Text16(30,10,0xff00ff,han2);
	} 
	return 0;	
}









lcd.h

/*********************************************
  NAME: class_lcd.h
  DESC:
 *********************************************/


#ifndef __class_lcd_h__
#define __class_lcd_h__

extern void lcd_Init(void);
extern void paint_pic(const unsigned char pic[]);
extern void paint_pixel(unsigned int x,unsigned int y, unsigned short colour );
extern void paint_line(int x1,int y1,int x2,int y2,int colour);
extern void Draw_Text16(int x,int y,int colour,unsigned char ch[]);//显示16*16汉字


extern const unsigned char gImage_test[];//图片数组


static  unsigned char han1[]={ 0x20, 0x4, 0x18, 0x4, 0x9,
0x24, 0xFF, 0xA4, 0x2, 0x24, 0x42, 0x24, 0x22, 0x24, 0x14, 0x24,
 0x14, 0x24, 0x8, 0x24, 0x8, 0x24, 0x14, 0x24, 0x22,
 0x4, 0x43, 0x4, 0x81, 0x14, 0x0, 0x8,

  };//刘
static  unsigned char han2[]={0x10, 0x4, 0x13, 0xFE, 0x12, 0x4,
0x12, 0x4, 0x57, 0xFC, 0x5A, 0x4, 0x52, 0x4, 0x93, 0xFC, 0x10, 0x40,
 0x10, 0x20, 0x13, 0xFC, 0x29, 0x8, 0x24, 0x88,
 0x40, 0x90, 0x47, 0xFE, 0x80, 0x0,
};//煜

static  unsigned char test0[]={0x0 ,0x0, 0x0, 0x0 ,0x0, 0x0, 0x7, 0xF0, 0x1C ,0x38, 0x38 ,
   0x1C, 0x38, 0x1C, 0x78, 0x1E ,0x78, 0x1E, 0x38, 0x1C, 0x38 ,0x1C ,0x38, 0x1C, 0x1C ,
   0x38, 0x7, 0xE0 ,0x0 ,0x0 ,0x0,0x0,};//0
 static  unsigned char test1[]={0x0, 0x0 ,0x0, 0x0 ,0x0 ,0x0,0x1, 0xC0, 0xF ,0xC0, 0x1,
 0xC0 ,0x1, 0xC0, 0x1, 0xC0, 0x1, 0xC0, 0x1, 0xC0, 0x1, 0xC0 ,0x1 ,0xC0, 0x1 ,0xC0,
  0x1F, 0xF8, 0x0, 0x0, 0x0, 0x0,};//1
static  unsigned char test2[]={0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF ,0xF0 ,0x18,0x18, 0x38,
 0x1C ,0x38, 0x1C, 0x0, 0x38, 0x0, 0x70, 0x1, 0xC0 ,0x7, 0x0 ,0xC, 0x4, 0x3F ,0xFC, 0x3F,
  0xFC, 0x0, 0x0, 0x0, 0x0,};//2
static  unsigned char test3[]={0x0 ,0x0 ,0

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值