⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 12864c.c

📁 C51的12864m
💻 C
字号:
/**************************************************************************/
/*   Time:2008/08/29													  */
/*   Author :wangyaming													  */
/*   Project for Tape driver test										  */
/*	This program create for manage key pad process						  */
/**************************************************************************/
#include"my_include.h"

INT8U code bmp1[];
INT8U COUNT3,COUNT2,COUNT1,COUNT,LCD_X,LCD_Y;
char point_up_down=0x00;
char point_left_right=0x00;


extern char point_up_down,point_left_right;
extern void disp_refresh(INT8U *up_down,INT8U *left_right);
void test(void);
extern void initial(void);
void wait(INT16U delay)
{
char temp=0xff;
	for(;delay>0;delay--)
	{temp=0xff;
	for(;temp>0;temp--);
	};
}

void check_busy(void) 
{ 
//TRISD=0xff;//在此处设为输入。 
PORTD=0xff; 
_nop_(); 
RS=0; 
_nop_(); 
RW=1; 
while (1) 
{ 
_nop_(); _nop_(); _nop_(); _nop_(); 
_nop_();_nop_();_nop_(); 
E =1; 
_nop_(); _nop_(); _nop_(); _nop_(); 
_nop_();_nop_();_nop_(); 
if (P0_7==0) break; 
_nop_();_nop_();_nop_(); _nop_(); _nop_(); _nop_(); 
E =0; 
} 
E =0; 
//TRISD=0X00;//还原为输出。 
P0_7=!P0_7; 
//delay_ms(50); 
} 
void write_comd_init(INT8U cmd)
{
//check_busy(); 
RS=0; 
RW=0; 
_nop_(); _nop_(); _nop_(); _nop_(); 
PORTD=cmd; 
_nop_(); _nop_(); _nop_(); _nop_(); 
E =1; 
_nop_(); _nop_(); _nop_(); _nop_(); 
_nop_(); 
_nop_(); 
E =0; 
}
void write_comd(INT8U cmd)
{
check_busy();
_nop_();_nop_();_nop_();     
RS=0; 
RW=0; 
PORTD=cmd; 
_nop_();_nop_();
E =1; 
_nop_(); _nop_();_nop_();_nop_();_nop_();
_nop_(); 
E =0; 
}
void write_data(INT8U *dat)
{
check_busy(); 
_nop_(); 
RS=1;
_nop_();  
RW=0; 
_nop_(); 
PORTD=*dat; 
_nop_(); 
E =1; 
_nop_(); 
_nop_(); 
_nop_(); 
E =0; 
}

void init_lcd_text()
{
write_comd(function_set_basic);
write_comd(set_point);
write_comd(open_point);
write_comd(close_point);
write_comd(clean_disp);
write_comd(reset_addr);

}

void init_lcd_pic()
{
_nop_();
write_comd_init(function_set_basic);
_nop_();
write_comd_init(set_point);
_nop_();
write_comd_init(open_point);
_nop_();
write_comd_init(close_point);
_nop_();
write_comd_init(clean_disp);
_nop_();
write_comd_init(reset_addr);
}
//***********************************************/
void init_mcu()
{
bit_ret=0;
P1=P2=P3=P0=0xff;
bit_psb=1;
relay=0;
_nop_();
_nop_();
_nop_();
bit_ret=1;
}
void WR_ZB(void) 
{ 
write_comd(command_extend); 
write_comd(LCD_Y); 
write_comd(LCD_X); 
write_comd(function_set_basic); 
} 
void clear_LCD(void) 
{ 
write_comd(0x01); 
write_comd(command_extend); 
write_comd(function_set_basic); 
} 
void disp_pic(const INT8U *s) 
{ 
COUNT3=0X02; 
LCD_X=0X80; 
for (;COUNT3!=0;COUNT3--) 
{ 
LCD_Y=0X80; 
COUNT2=0X20;//32 
for (;COUNT2!=0;COUNT2--) 
{ 
COUNT1=0X10;//16 
WR_ZB(); 
for (;COUNT1!=0;COUNT1--) 
{ 
write_data(s++); 
} 
LCD_Y+=1; 
} 
LCD_X=0X88; 
} 
write_comd(graphic_on); 
write_comd(function_set_basic);
write_comd(close_point); 
} 
//__________________________________
void disp_text(char addr,char *string)
{
char count;
write_comd(addr);
	for(count=0;count<=17;count++)
	{
		write_data(string++);					
	}
}
void mai(void)
{
wait(65535);
wait(65535);
init_mcu();
init_lcd_pic();
clear_LCD();
disp_pic(bmp1);
//wait(65535);

}
INT8U code  bmp1[]=
{

/*------------------------------------------------------------------------------
;  源文件 / 文字 : C:\Documents and Settings\Administrator\Desktop\untitled.bmp
;  宽×高(像素): 128×63
------------------------------------------------------------------------------*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x0C,0x0C,0x0F,0x1F,0x1F,0x10,0x10,0x00,
0x00,0x1F,0x1F,0x1F,0x10,0x11,0x11,0x1D,0x0C,0x00,0x00,0x01,0x0F,0x0F,0x0E,0x0D,
0x0F,0x0F,0x0E,0x0E,0x0E,0x03,0x03,0x02,0x02,0x02,0x03,0x03,0x03,0x02,0x02,0x02,
0x1F,0x1F,0x1F,0x12,0x02,0x03,0x03,0x03,0x02,0x02,0x02,0x02,0x0F,0x0F,0x0F,0x02,
0x02,0x03,0x03,0x03,0x02,0x02,0x02,0x02,0x0E,0x0C,0x0C,0x0C,0x0E,0x02,0x02,0x02,
0x02,0x02,0x03,0x03,0x00,0x00,0x0D,0x0D,0x0D,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,
0x0C,0x0C,0x1F,0x1F,0x1F,0x0C,0x0C,0x00,0x02,0x02,0x02,0x02,0x02,0x02,0x03,0x1F,
0x1F,0x1E,0x12,0x02,0x02,0x02,0x02,0x02,0x0E,0x0E,0x02,0x02,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x41,0x41,0x41,0xFF,0xFF,0xFF,0x46,0x46,0x40,
0x40,0xFE,0xFF,0xFF,0x4F,0xCE,0xCE,0xC8,0x40,0x3E,0x3E,0xFF,0xC1,0xC1,0x00,0xFF,
0xFF,0xFF,0x40,0x7F,0x7F,0xFF,0xFF,0x3F,0x3F,0x00,0xFF,0xFF,0xFF,0x01,0x3F,0x3F,
0xFF,0xFF,0xFF,0x3E,0x0E,0xFF,0xFF,0xFF,0x31,0x31,0x31,0x31,0xFF,0xFF,0xFF,0x00,
0x00,0xCE,0xFF,0xFF,0x71,0x47,0x7F,0x7F,0x39,0x3F,0x3F,0x3F,0x39,0x7F,0x7F,0x77,
0x31,0x31,0xFF,0xCE,0x00,0x00,0xFF,0xFF,0xFF,0x30,0x30,0x30,0x30,0x30,0x30,0x30,
0x30,0x30,0xF8,0xF8,0xF8,0x00,0x00,0x00,0x01,0x07,0x07,0x0E,0x38,0x38,0xFF,0xFF,
0xFF,0x36,0x36,0x36,0x36,0x36,0x3F,0x3F,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xD8,0x1C,0x1C,0xFC,0xF8,0xF8,0x00,0x04,0x1C,
0x1C,0x38,0xE0,0xE0,0xF8,0x3C,0x3C,0xFC,0xE4,0x00,0x00,0xFF,0xFF,0xFF,0x03,0xFF,
0xFF,0xFF,0x03,0xFF,0xFF,0xFF,0xFF,0xE3,0xE3,0x03,0xFF,0xFF,0xFC,0x00,0x00,0x00,
0xFC,0xFC,0xFC,0x00,0x00,0xFC,0xFC,0xFC,0x18,0x18,0x18,0x18,0xFC,0xFC,0xFC,0x00,
0x00,0x3C,0xFF,0xFF,0xC7,0xFF,0xFF,0xFF,0xC3,0xE3,0xE3,0x3B,0xFB,0xFF,0xFF,0x1F,
0xC3,0xC3,0xFF,0x3C,0x00,0x00,0xE0,0xF8,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
0x18,0x18,0x18,0x18,0xF8,0xF8,0xF8,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0xFC,
0xFC,0xC0,0xC0,0xC4,0xC4,0xC4,0xFC,0xFC,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x07,0x07,0x06,0x07,0x07,0x01,0x00,0x00,
0x00,0x00,0x01,0x01,0x07,0x06,0x06,0x07,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x01,0x01,0x07,0x06,0x07,0x07,0x01,0x00,0x00,0x00,0x07,0x07,0x07,0x06,0x06,
0x06,0x06,0x06,0x06,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x07,0x07,
0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x07,0x06,0x06,0x07,0x01,0x01,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x00,
0x00,0xE0,0xE0,0xE0,0x03,0x07,0x07,0x1C,0xF8,0xE0,0xE0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0xFC,0xFC,0xFC,0x18,0x18,
0x18,0x1C,0x07,0x07,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,
0xFF,0x00,0x00,0x00,0x00,0xF8,0xF8,0xFC,0x07,0x03,0x03,0x07,0xFF,0xFF,0xFF,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xF0,0x1C,0x1C,0x0C,0x1C,0x1C,0xF0,0xE0,0x00,
0x00,0x7C,0xFC,0xFC,0x8C,0x0C,0x0C,0x1C,0x7C,0x60,0x60,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xE0,0xF0,0xF0,0x1C,0x0C,0x1C,0x1C,0xF0,0xE0,0xE0,0x00,0x60,0x70,0x70,0x1C,0x0C,
0x0C,0x1C,0xF0,0xF0,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x0C,0x0C,0xFC,0xFC,
0xFC,0x0C,0x0C,0x0C,0x00,0x00,0x00,0x1C,0x1C,0x0C,0x0C,0x1C,0xF0,0xF0,0xE0,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
} ;


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -