发表于:2009/2/2 10:21:51
#0楼
#include
#include
/************汉字点阵*************/
uchar code hanzi[4][32] = //一个汉字分两行,所以数组二维数为字数的两倍
{
{0x00,0x02,0x00,0x0c,0xff,0xf0,0xa0,0x01,0xaf,0x91,0xaa,0xe2,0xba,0xba,0xaa,0xa4,
0xaa,0xa4,0xaa,0xaa,0xaa,0xb2,0xaf,0xa3,0xa0,0x02,0x80,0x02,0x00,0x00,0x00,0x00}, //厦,0
{0x00,0x00,0x00,0x00,0x1f,0xff,0x80,0x00,0x60,0x00,0x00,0x00,0x40,0x00,0x40,0x00,
0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x02,0x40,0x01,0x7f,0xfe,0x00,0x00,0x00,0x00}, //门,1
{0x04,0x00,0x04,0x01,0x04,0x02,0x04,0x04,0x04,0x08,0x04,0x30,0x05,0xc0,0xfe,0x00,
0x05,0x80,0x04,0x60,0x04,0x10,0x04,0x0c,0x04,0x06,0x04,0x03,0x04,0x02,0x00,0x00}, //大,2
{0x02,0x00,0x0c,0x40,0x08,0x40,0x48,0x40,0x3a,0x40,0x2a,0x40,0x0a,0x42,0x8a,0x41,
0x7a,0xfe,0x2b,0x40,0x0a,0x40,0x18,0x40,0xea,0x40,0x4c,0x40,0x08,0x40,0x00,0x00} //学,3
};
/************位定义**************/
sbit sttp = p2^7;
/************变量声明***********/
uint n,i,j; //delay()延时函数计数变量
uint x,y,z; //out_hanzi()
/************函数声明***********/
void delay(uint n); //延时函数
void out_rxd(uchar *d); //汉字输出
/************主函数**************/
void main()
{
scon = 0x00;
while(1)
{
p1 = 0;
for( x = 0; x
/************子函数定义?********/
void delay(uint n)
{
for( ; n > 0 ; n--)
{
for( j = 0; j
}
void out_rxd(uchar *d)
{
sbuf = *d; //启动串行口传送
while(ti == 0); //等待串口传送结束
ti = 0; //将串口中断标志位置0
}
、、、、、、、、、、、、、、、、、、、、、、、、、
#define fosc 24 //定义晶振频率
#define init_th0 0x3c //定时器t0初始值
#define init_tl0 0xb0
#define tmod_t00 0x00 //定义t0为方式0,gate=0,c/t=0,13位计数器
#define tmod_t01 0x01 //定义t0为方式1,gate=0,c/t=0,16位计数器
#define tmod_t02 0x02 //定义t0为方式2,gate=0,c/t=0,自动装入8位计数器
#define tmod_t03 0x03 //定义t0为方式3,gate=0,c/t=0,定时器0分成两个8位计数器,定时器1停止计数
/*缩定定义*/
#define uchar unsigned char
#define uint unsigned int
/*p1口位定义*/
/*p2 bit define*/
/*p3 bit define*/
----------------------------------------------
此篇文章从博客转发
原文地址: Http://blog.gkong.com/more.asp?id=75256&Name=mahuaqiang