字符显示程序,拨打电话程序:
(程序有待完善)
void Displaytxt(int x0, int y0, int who, U16 color )// 显示数字(16*32)
{
U16 txt = 0;
U16 l = 0, h = 0, x = 0, y = 0, z = 0;
for ( h = 0; h < 32; h++ )
{
x = (U16)gImage_number[who][h][z];
y = (U16)gImage_number[who][h][z+1];
txt = y<<8 | x;
for ( l = 0; l < 16; l++ )//L=16的时候跳出
{
if( (txt>>l)%2 == 1 )
LCD_BUFFER[y0+h][x0+l] = color;
}
}
}
void Displaytxtbig(int x0, int y0, int who, U16 color )// 显示数字(32*64)
{
U32 txt = 0;
U16 l = 0, h = 0, a = 0, b = 0, c = 0, d = 0, z = 0;
extern int X0;
if ( who == 0 )
who = 10;
who -= 1;
for ( h = 0; h < 64; h++ )
{
a = (U16)gImage_numberbig[who][h][z];
b = (U16)gImage_numberbig[who][h][z+1];
c = (U16)gImage_numberbig[who][h][z+2];
d = (U16)gImage_numberbig[who][h][z+3];
txt = d<<24 | c << 16 | b<<8 | a;
for ( l = 0; l < 32; l++ )//L=16的时候跳出
{
if( (txt>>l)%2 == 1 )
LCD_BUFFER[y0+h][x0+l] = color;
}
}
X0 += 32;
if ( X0 >= 384 )
X0 = 384 - 32;
}
void Displaytxthz(int x0, int y0, int who, U16 color, unsigned char bmp[3][32][4])//显示汉字32*32
{
U32 txt = 0;
U16 l = 0, h = 0, a = 0, b = 0, c = 0, d = 0, z = 0;
for ( h = 0; h < 32; h++ )
{
a = bmp[who][h][z];
b = bmp[who][h][z+1];
c = bmp[who][h][z+2];
d = bmp[who][h][z+3];
txt = d<<24 | c << 16 | b<<8 | a;
for ( l = 0; l < 32; l++ )//L=16的时候跳出
{
if( (txt>>l)%2 == 1 )
LCD_BUFFER[y0+h][x0+l] = color;
}
}
}
void Displayhz( int x0, int y0, int gs, unsigned char bmp[3][32][4] )//连续显示"gs"个汉字
{
int k;
for ( k = 0; k < gs; k++ )
{
Displaytxthz( x0, y0, k, 0x1f, bmp );
x0 = x0 + 32; //光标后移
}
}
void Bank( int x0, int y0 ) //擦除显示
{
int x, y, m, n;
for ( y = 0, m = y + 54; y < m; y++ )
for ( x = 0, (n = x + 32) && X0 >= 0; x < n; x++ )
LCD_BUFFER[y0+y][x0+x] = 0xffff;
}
void Del(void)//删除字符
{
extern int X0;
Bank( X0, 12 );
X0 -= 32;
if( X0 < 0 )
X0 = 0;
Bank( X0, 12 );
}
void Delhz(void)//删除汉字//由于汉字和数字的完度不同,所以可以用两个函数分别实现
{
extern int X0;
X0 -= 32;//光标后移
if( X0 < 0 )
X0 = 0;
Bank( X0, 12 );
}
void phone(void)//拨打电话功能函数
{
extern volatile int xdata;
extern volatile int ydata;
//extern unsigned char Buffer[20];
extern U16 fz;
extern int i;
int e = 2400000;
int x = -1;
Displayhz( 0, 34, 7, gImage_opengsm );//显示提示信息
puts("ATr"); //发送连机命令
while ( e-- ){rGPBDAT &= 0xffff;} //等待
Paint_Bank( 0, 6, 480, 54 );
Displayhz( 0, 34, 13, gImage_inputnumber ); //显示连机成功信息
e = 9600000;
while ( e-- ){rGPBDAT &= 0xffff;}
Paint_Bank( 0, 6, 480, 54 );
Displayhz( 382, 34, 3, gImage_input );//输入提示信息
X0 = 0;
xdata = -1; ydata = -1;
if( fz ==1 )
while( Flag == 2 )
{
if( xdata >= 68+12 && xdata <= 267-12 && ydata >= 545+12 && ydata <= 670-12 ) //判断按键位置,设置相应按键的功能
{w = '1'; x = 1; delay();/*去抖*/ Displaytxtbig(X0, 12, 1, 0x6545 ); xdata = -1; ydata = -1; }
if( xdata >= 267+12 && xdata <= 456-12 && ydata >= 545+12 && ydata <= 670-12 )
{w = '2'; x = 1;delay(); Displaytxtbig(X0, 12, 2, 0x6545 ); xdata = -1; ydata = -1; }
if( xdata >= 456+12 && xdata <= 637-12 && ydata >= 545+12 && ydata <= 670-12 )
{w = '3'; x = 1;delay(); Displaytxtbig(X0, 12, 3, 0x6545 ); xdata = -1; ydata = -1; }
if( xdata >= 683+12 && xdata <= 935-12 && ydata >= 545+12 && ydata <= 670-12 )
{x = 1; delay(); Del(); i=i-2; if(i<=0) i=0; xdata = -1; ydata = -1; }
if( xdata >= 68+12 && xdata <= 267-12 && ydata >= 227+12 && ydata <= 401-12 )
{w = '7'; x = 1; delay(); Displaytxtbig(X0, 12, 7, 0x6545 ); xdata = -1; ydata = -1; }
if( xdata >= 267+12 && xdata <= 456-12 && ydata >= 227+12 && ydata <= 401-12 )
{w = '8'; x = 1; delay(); Displaytxtbig(X0, 12, 8, 0x6545 ); xdata = -1; ydata = -1; }
if( xdata >= 456+12 && xdata <= 637-12 && ydata >= 227+12 && ydata <= 401-12 )
{w = '9'; x = 1; delay(); Displaytxtbig(X0, 12, 9, 0x6545 ); xdata = -1; ydata = -1; }
if( xdata >= 683+12 && xdata <= 935-12 && ydata >= 227+12 && ydata <= 401-12 )
{w = '