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

📄 hg24012802c.c

📁 240128.rar
💻 C
📖 第 1 页 / 共 2 页
字号:
void Func_int0() interrupt 0 using 1
{
	if (ui_pause == 0)
 		ui_pause = 1;
	else
		ui_pause = 0;


	if ( ui_pause == 1 )
		while (1)
		{
			if (PAUSE == 0)
				return;
		}
}

//Write Instruction Code
#pragma disable
void wr_cmd(uchar cmd)
{
	LCMCP = cmd;
/*	CE_Port = 0;
	_nop_();
	_nop_();

	RD_Port = 1;
	_nop_();
	_nop_();

	WR_Port = 1;
	_nop_();
	_nop_();

	CD_Port = 1;
	_nop_();
	_nop_();

	WR_Port = 0;
	_nop_();
	_nop_();

	DataPort = cmd;
	_nop_();
	_nop_();

	WR_Port = 1;
	_nop_();
	_nop_();

	CE_Port = 1;
	_nop_();
	_nop_();*/

}

//Write Display RAM Data
#pragma disable
void wr_dat(uchar dat)
{
	LCMDP = dat;
/*	CE_Port = 0;
	_nop_();
	_nop_();

	RD_Port = 1;
	_nop_();
	_nop_();

	WR_Port = 1;
	_nop_();
	_nop_();

	CD_Port = 0;
	_nop_();
	_nop_();

	WR_Port = 0;
	_nop_();
	_nop_();

	DataPort = dat;
	_nop_();
	_nop_();

	WR_Port = 1;
	_nop_();
	_nop_();

	CE_Port = 1;
	_nop_();
	_nop_();*/

}

//Write 2 Para Command
#pragma disable
void wr_cmd2para(uchar dat1,uchar dat2,uchar cmd)
{
	wr_dat(dat1) ;
	wr_dat(dat2) ;

	wr_cmd(cmd);
}

//T6963C Initial
#pragma disable
void initial()
{
unsigned char i,j;
	delay();
  	wr_cmd2para(0x00,0x00,0x40);    /* Text home address set = 0000H */

  	wr_cmd2para(0x00,0x00,0x42);    /* Graphic home address set = 0000H */

  	wr_cmd2para(0x20,0x00,0x41);      /* Text area set = 30 columns */

  	wr_cmd2para(0x20,0x00,0x43);      /* Graphic area set = 30 columns */

  	wr_cmd(0x80);              		/* (Mode set)"OR" mode,internal character generater mode */

  	wr_cmd2para(0x02,0x00,0x22);    /* Offset register set */

}

//Display Usual Context
#pragma disable
void disp_dots(uchar dat1,uchar dat2)
{
	uint row_cnt,col_cnt;

	wr_cmd(0x98);              /* (Display mode)Text off,graphics on,cursor off */

	wr_cmd2para(0,0,0x24);     /* Address at 0 line,0 column */

	wr_cmd(0xB0);              /* Awron (data auto write set) */

	for(row_cnt=0;row_cnt<64;row_cnt++)
	{
	    for(col_cnt=0;col_cnt<32;col_cnt++)
	    {
	      wr_dat(dat1);
	    }
	    for(col_cnt=0;col_cnt<32;col_cnt++)
	    {
	      wr_dat(dat2);
	    }
	}
	wr_cmd(0xB2);              /* Awroff (auto reset) */

	delayms();
}
unsigned char code yong[] = {
0x00,0x40,0x40,0x48,0x48,0xC8,0x09,0xFA,0x46,0x80,0x40,0x20,0x30,0x00,0x00,0x00,
0x20,0x20,0x10,0x0C,0x03,0x40,0x80,0x7F,0x00,0x00,0x03,0x04,0x08,0x10,0x10,0x00
};
void disp_chiness(uchar x,uchar y,uchar *hzptr)
{
	uint row_cnt,col_cnt;

	wr_cmd(0x98);              /* (Display mode)Text off,graphics on,cursor off */

	wr_cmd2para(0,0,0x24);     /* Address at 0 line,0 column */

//	wr_cmd(0xB0);              /* Awron (data auto write set) */

	for(row_cnt=x;row_cnt<x+8;row_cnt++)
	{

	    for(col_cnt=y;col_cnt<2+y;col_cnt++)
	    {
                wr_cmd2para(row_cnt,0,0x24);
	      wr_dat(*hzptr++);
	    }
	}
//	wr_cmd(0xB2);              /* Awroff (auto reset) */

	delayms();
}
//Display Usual Context
#pragma disable
void disp_TwistRow(uchar dat1,uchar dat2)
{
	uint row_cnt,col_cnt;

	wr_cmd(0x98);              /* (Display mode)Text off,graphics on,cursor off */

	wr_cmd2para(0,0,0x24);     /* Address at 0 line,0 column */

	wr_cmd(0xB0);              /* Awron (data auto write set) */

	for(row_cnt=0;row_cnt<32;row_cnt++)
	{
	    for(col_cnt=0;col_cnt<32;col_cnt++)
	    {
	      	wr_dat(dat1);
		  	wr_dat(dat1);
	    }
	    for(col_cnt=0;col_cnt<32;col_cnt++)
	    {
	      	wr_dat(dat2);
		  	wr_dat(dat2);
	    }
	}
	wr_cmd(0xB2);              /* Awroff (auto reset) */

	delayms();
}

//Display Border
#pragma disable
void disp_Border()
{
	uint row_cnt,col_cnt,byte_cnt;

	wr_cmd(0x98);              /* (Display mode)Text off,graphics on,cursor off */

	wr_cmd2para(0,0,0x24);     /* Address at 0 line,0 column */

	wr_cmd(0xB0);              /* Awron (data auto write set) */

	byte_cnt = 0;

	for(byte_cnt=0;byte_cnt<32;byte_cnt++)
		wr_dat(0xFF);

	for(row_cnt=0;row_cnt<126;row_cnt++)
	{
		wr_dat(0x80);

	    for(col_cnt=0;col_cnt<28;col_cnt++)
	    	wr_dat(0x00);

		wr_dat(0x01);
		wr_dat(0xFF);
		wr_dat(0xFF);
 	}

	for(byte_cnt=0;byte_cnt<32;byte_cnt++)
		wr_dat(0xFF);

	wr_cmd(0xB2);              /* Awroff (auto reset) */

	delayms();
}

//Display Picture
#pragma disable
void disp_pic(uchar_code *pic_area)
{
	uint row_cnt,col_cnt,byte_cnt;

	wr_cmd(0x98);              /* (Display mode)Text off,graphics on,cursor off */

	wr_cmd2para(0,0,0x24);     /* Address at 0 line,0 column */

	wr_cmd(0xB0);              /* Awron (data auto write set) */

	byte_cnt = 0;

	for(row_cnt=0;row_cnt<128;row_cnt++)
	{
	    for(col_cnt=0;col_cnt<32;col_cnt++)
	    {
	      wr_dat(pic_area[byte_cnt]);
		  byte_cnt ++;
	    }

	}
	wr_cmd(0xB2);              /* Awroff (auto reset) */

	delayms();
}

void main(void)
{

	EA=1; //Interurupt Enabled

	IT0 = 1;//INT0 Low Level Trigger

	EX0 = 1;//INT0 Enabled

/*	RST_Port = 0;
	delay();
	delay();

	RST_Port = 1;
	delay();*/

	FS_Port	= 0;
	delay();

  	initial();

  while(1)
  {
  disp_chiness(10,10,yong);
    disp_dots(0xff,0xff);

    disp_dots(0x00,0x00);

	disp_dots(0xff,0x00);

	disp_dots(0x00,0xff);

	disp_TwistRow(0xff,0x00);

	disp_dots(0xAA,0xAA);

    disp_dots(0x55,0x55);

	disp_dots(0xCC,0xCC);

	disp_dots(0xaa,0x55);

    disp_dots(0x55,0xaa);

    disp_Border();

	disp_pic(ChineseChar);

  }
}

⌨️ 快捷键说明

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