#include "spce061a.h"
const unsigned char bmp3[]={0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x05,0xAE,0x90,0x00,0x00,0x00,0x00,0x00,
0x95,0x55,0x48,0x80,0x00,0x00,0x00,0x00,
0x2B,0x55,0x00,0x00,0x00,0x00,0x00,0x00,
0xA8,0x00,0x22,0x15,0x20,0x00,0x00,0x00,
0x97,0xFB,0x00,0x00,0x00,0x00,0x00,0x00,
0x45,0x55,0x08,0xA0,0x00,0x00,0x00,0x0A,
0x6F,0xF4,0x00,0x00,0x00,0x00,0x00,0x00,
0xB2,0x80,0x40,0x00,0x04,0x40,0x00,0x00,
0xBA,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,
0x4D,0x55,0x15,0x15,0x20,0x00,0x00,0x95,
0xD5,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xFF,0xE8,0x40,0x40,0x00,0x00,0x00,0x4A,
0xAA,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
0xFF,0xFF,0x2A,0x00,0x40,0x00,0x00,0x15,
0x54,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xFF,0xFD,0xD0,0xAA,0x01,0x00,0x00,0x25,
0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,
0xFF,0xFF,0xB6,0x00,0x10,0x00,0x01,0x4A,
0x49,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xFF,0xFF,0xFD,0xE8,0x40,0x00,0x00,0x11,
0x00,0x24,0x84,0x00,0x00,0x00,0x00,0x00,
0xAB,0xFF,0xFF,0x55,0x00,0x00,0x00,0x24,
0x02,0x49,0x5E,0xA0,0x00,0x00,0x00,0x00,
0x84,0xBF,0xFF,0xF4,0x88,0x00,0x00,0x00,
0x10,0x05,0xFF,0xF4,0x00,0x00,0x00,0x00,
0x29,0x0B,0xFF,0xFA,0x20,0x00,0x00,0x00,
0x02,0xBF,0xFF,0xFC,0x00,0x00,0x00,0x00,
0x44,0xA0,0x57,0xFD,0x80,0x00,0x00,0x00,
0x08,0x5F,0xFF,0xFF,0x80,0x00,0x00,0x00,
0x91,0x0A,0xAA,0xF6,0x50,0x00,0x00,0x00,
0x41,0xFF,0xFF,0xFF,0xC0,0x00,0x00,0x00,
0x44,0xA0,0x01,0x1B,0x84,0x00,0x00,0x00,
0x26,0xFF,0xFF,0xFF,0x90,0x00,0x00,0x00,
0x11,0x0A,0xAA,0x6D,0x68,0x00,0x00,0x00,
0x0B,0xFB,0xFF,0xEF,0xE0,0x00,0x00,0x00,
0xC4,0xA0,0x01,0x02,0x80,0x00,0x00,0x00,
0x43,0xF1,0xFE,0x63,0xF0,0x00,0x00,0x00,
0x15,0x55,0x54,0x55,0x6A,0x00,0x00,0x00,
0x9F,0xE3,0xFC,0x87,0x38,0x00,0x00,0x00,
0xCA,0xAB,0x91,0x00,0x90,0x00,0x00,0x00,
0x07,0xC1,0xFA,0x2A,0x80,0x00,0x00,0x00,
0x25,0xFF,0xFE,0x95,0x2A,0x00,0x00,0x00,
0x2F,0x13,0xFE,0xFC,0x10,0x00,0x00,0x00,
0x95,0xFF,0xFF,0xC0,0x50,0x00,0x00,0x00,
0x0F,0x41,0xFF,0xF3,0x80,0x00,0x00,0x00,
0x4F,0xFF,0xFF,0xF9,0x2A,0x00,0x00,0x00,
0x9F,0x08,0xFF,0xD4,0x00,0x00,0x00,0x00,
0xB3,0xFF,0xFF,0xFE,0x54,0x80,0x00,0x00,
0x1E,0xA0,0x7F,0xA0,0x00,0x00,0x00,0x00,
0x5F,0xFE,0x7F,0xFE,0xAA,0x00,0x00,0x00,
0x5F,0x57,0xFE,0x00,0x00,0x00,0x00,0x00,
0xAF,0xFD,0x7F,0xFF,0x94,0x80,0x00,0x00,
0x1F,0xFE,0xE8,0x00,0x00,0x00,0x00,0x00,
0x7F,0xFA,0x7F,0x5F,0xCA,0x00,0x00,0x00,
0x3F,0x55,0x00,0x00,0x00,0x00,0x00,0x00,
0xAF,0xF1,0x7F,0xDE,0xF5,0x40,0x00,0x00,
0x1A,0xA0,0x80,0x00,0x00,0x00,0x00,0x00,
0xDF,0xF2,0x3F,0xFC,0xC2,0x00,0x00,0x00,
0x50,0x08,0x00,0x00,0x00,0x00,0x00,0x00,
0x2F,0xFA,0xBF,0xFF,0xF4,0xA0,0x00,0x00,
0x05,0x42,0x00,0x00,0x00,0x00,0x00,0x00,
0x97,0xFE,0x3F,0xFF,0xE3,0x00,0x00,0x00,
0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x68,0xFF,0xDF,0xD5,0x78,0x40,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x07,0x5F,0xFF,0x48,0x02,0x80,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xD0,0xAA,0xF4,0xA0,0xAA,0x40,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x0A,0x45,0x09,0x05,0x11,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xA1,0x28,0xA0,0x00,0x44,0x40,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x08,0x42,0x04,0x52,0x12,0x80,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xA5,0x09,0x51,0x00,0x48,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x50,0x04,0x4A,0x12,0x80,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xAA,0x05,0x50,0x21,0x48,0x20,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x90,0x02,0x84,0x12,0x80,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xD4,0x05,0x48,0x10,0x48,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x81,0x20,0x00,0x02,0x02,0x80,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xA4,0x84,0x92,0x48,0x94,0x40,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x48,0x10,0x00,0x00,0x21,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,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,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
main()
{Init_IO();
lcdreset();
while(1)
{lcdreset();
Full_Screen("黄河远上白去间,一片孤城万仞山。羌笛无须怨杨柳,春风不度玉门关。");
lcdwc(0x01);
delayns(5000,100);
Disp_img(bmp3);
delayns(5000,100);
lcdwc(0x01);
delayns(50,10);
}
;}
void Disp_img(unsigned char *img) //图形方式12864显示字模221 横向取模
{
unsigned char i,j;
unsigned int k = 0;
lcdwc(0x36); //图形方式
for(i=0;i<32;i++) //上半屏显示
{lcdwc(0x80+i); //Y的坐标;
lcdwc(0x80); //X的坐标
*P_Watchdog_Clear=0x1;
for(j=0;j<16;j++)
{ lcdwd(img[k++]);
*P_Watchdog_Clear=0x1;
}
}
for(i=0;i<32;i++) //下半屏显示
{ lcdwc(0x80+i); //Y的坐标;
lcdwc(0x88); //X的坐标
*P_Watchdog_Clear=0x1;
for(j=0;j<16;j++)
{lcdwd(img[k++]);
*P_Watchdog_Clear=0x1;
}
}
}
void Init_IO()//设置IOB口为输出口
{ *P_IOB_Dir=0xffff;
*P_IOB_Attrib=0xffff;
}
void delayns(int aa,int bb)
{int i,j;
for(i=0;i<aa;i++)
for(j=0;j<bb;j++)
*P_Watchdog_Clear=0x0001;
}
void delay()
{int i,j;
for(i=0;i<5;i++)
for(j=0;j<5;j++)
;
}
void lcdreset()
{ delayns(20,20);
lcdwc(0x30); //选择基本指令集
lcdwc(0x30); //选择8bit数据流
delay();
lcdwc(0x0c); //开显示(无游标、不反白)
delay(5);
lcdwc(0x01); //清除显示,并且设定地址指针为00H
delay(5);
lcdwc(0x06); //指定在资料的读取及写入时,设定游标的移动方向及指定显示的移位
}
void Set_Addr(unsigned int addr)//设定DDRAM的地址。
{delayns(10,10);
*P_IOB_Data=0x0180+addr;
delay();
*P_IOB_Data&=0xfeff;
delay();
}
int Read_Addr()//读取DDRAM地址
{int addr;
delayns(10,10);
*P_IOB_Dir=0xff00;
*P_IOB_Attrib=0xff00;
*P_IOB_Data=0x03ff;
delay();
*P_IOB_Data&=0xfeff;
delay(20,20);
addr=(*P_IOB_Data)&0x001f;
return addr;
}
void Write_Data(unsigned char *str)//写数据到DDRAM
{delayns(5,5);
Init_IO();
while(*str!='\0')
{ //Init_IO();
*P_IOB_Data=0x0500+*str++;
delay();
*P_IOB_Data&=0xfeff;
delay();
}
*str=0;
*P_Watchdog_Clear=0x1;
}
void Full_Screen(unsigned char *str)
{int count="0";
delayns(5,5);
Init_IO();
while(*str!='\0')
{*P_IOB_Data=0x0500+*str++;
delay();
*P_IOB_Data&=0xfeff;
delay();
count++;
if(count==16)
Set_Addr(0x10);
if(count==32)
Set_Addr(0x0008);
if(count==48)
{ Set_Addr(0x0018);
count="0";}}
*str=0;
*P_Watchdog_Clear=0x1;
}
void lcdwc(unsigned int com)
{delayns(5,5);
*P_IOB_Data=0x0100+com;
delay();
*P_IOB_Data&=0xfeff;
delay();
}
void lcdwd(unsigned int data)
{ delayns(5,5);
*P_IOB_Data=0x0500+data;
delay();
*P_IOB_Data&=0xfeff;
delay();
}
用户406215 2008-10-4 20:49