#include "uart.h"
#define RELOAD_COUNT 0xFA
void UART_Init(void)
{
SCON=0X50;
TMOD=0X20;
PCON=0X80;
TH1=RELOAD_COUNT;
TL1=TH1;
//ES=1;
EA=1;
TR1=1;
TI=1;
}
void UART_Cmd(FunctionalState ensta)
{
ES=ensta;
}
void UART_SendData(u8 dat)
{
ES=0;
TI=0;
SBUF=dat;
while(TI==0);
TI=0;
ES=1;
}
void UART_SendString(u8 *pbuf)
{
while(*pbuf!='\0')
{
UART_SendData(*pbuf);
delay_10us(5);
pbuf++;
}
}
u8 UART_RX_BUF[UART_REC_LEN];
//bit15,
//bit14,
//bit13~0,
u16 UART_RX_STA=0;
void UART_IRQn() interrupt 4
{
u8 r;
if(RI)
{
RI=0;
r=SBUF;
if((UART_RX_STA&0x8000)==0)
{
if(UART_RX_STA&0x4000)
{
if(r!=0x0a)UART_RX_STA=0;
else UART_RX_STA|=0x8000;
}
else
{
if(r==0x0d)UART_RX_STA|=0x4000;
else
{
UART_RX_BUF[UART_RX_STA&0X3FFF]=r ;
UART_RX_STA++;
if(UART_RX_STA>(UART_REC_LEN-1))UART_RX_STA=0;
}
}
}
}
}
#include "public.h"
void delay_10us(u16 us)
{
while(us--);
}
void delay_ms(u16 ms)
{
u16 i,j;
for(i=ms;i>0;i--)
for(j=110;j>0;j--);
}
#include "public.h"
#include "uart.h"
#include "tftlcd.h"
#include "touch.h"
#include "gui.h"
#include "9dtest_56_pic.h"
#include "calc_56_pic.h"
#include "earthnet_56_pic.h"
#include "picture_56_pic.h"
#define PICTURE_START_X 30
#define PICTURE_START_Y 50
#define PICTURE_SPACE_X 10
#define PICTURE_SPACE_Y 10
#define PICTURE_WIDTH 56
#define PICTURE_HEIGHT 56
const u8 *pic_buf[]={gImage_9dtest_56_pic,gImage_calc_56_pic,gImage_earthnet_56_pic,gImage_picture_56_pic};
void main()
{
u8 i=0;
u8 j=0;
UART_Init();
TFTLCD_Init();
FRONT_COLOR=RED;
LCD_ShowString(10,10,tftlcd_data.width,tftlcd_data.height,16,"BMP Picture Test");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
LCD_ShowPicture(PICTURE_START_X+(PICTURE_WIDTH+PICTURE_SPACE_X)*j,
PICTURE_START_Y+(PICTURE_HEIGHT+PICTURE_SPACE_Y)*i,
PICTURE_WIDTH,PICTURE_HEIGHT,pic_buf[2*i+j]);
}
}
while(1)
{
}
}
代码是一个工程,发上来
10,TFTLCD触摸屏实验--BMP图片显示.rar
(158.16 KB)
[此贴子已经被作者于2019-5-9 06:25编辑过]