📄 test21.c
字号:
#include "REG5402.h"
int char1[14]={0x57,0x55,0x48,0x41,0x4e,0x20,0x5a,0x48,0x4f,0x4e,0x47,0x59,0x4f,0x55};
int char2[16]={0x54,0x65,0x6c,0x3a,0x30,0x32,0x37,0x2d,0x38,0x37,0x33,0x38,0x33,0x31,0x31,0x36};
int char3[16]={0x46,0x61,0x78,0x3a,0x30,0x32,0x37,0x2d,0x38,0x37,0x33,0x38,0x31,0x36,0x39,0x30};
int char4[15]={0x50,0x6f,0x73,0x74,0x63,0x6f,0x64,0x65,0x3a,0x34,0x33,0x30,0x30,0x37,0x30};
int char5[6]={0x01,0x04,0x0c,0x14,0x38,0x01};
int time1_over;
void cpu_init()
{
PMST=0x3fa0;
SWWSR=0x7fff;
BSCR=0x0002;
SWCR=0x0000;
IMR=0;
IFR=IFR;
}
void set_t0()
{
asm(" ssbx intm");
TCR0=0x0a18;
PRD0=0x0007;
IMR=IMR|0x0008;
IFR=IFR;
asm(" rsbx intm");
}
void busy()
{
TCR0=0x0a28;
PRD0=0x1800;
while(time1_over==0);
time1_over=0;
}
main()
{
int i;
cpu_init();
set_t0();
time1_over=0;
/*********液晶屏初始化*************/
for(i=0;i<6;i++)
{
READS=char5[i]|0x0400; /*rs=0,wr=0,e=1*/
busy();
READS=char5[i]|0x0000; /*e=0*/
busy();
}
/*****the first line *****/
READS=0x0080|0x0400;
busy();
READS=0x0080|0x0000;
busy();
for(i=0;i<14;i++)
{
READS=char1[i]|0x0500;
busy();
READS=char1[i]|0x0100;
busy();
}
/*****the second line *****/
READS=0x00c0|0x0400;
busy();
READS=0x00c0|0x0000;
busy();
for(i=0;i<16;i++)
{
READS=char2[i]|0x0500;
busy();
READS=char2[i]|0x0100;
busy();
}
/*****the third line *****/
READS=0x0094|0x0400;
busy();
READS=0x0094|0x0000;
busy();
for(i=0;i<16;i++)
{
READS=char3[i]|0x0500;
busy();
READS=char3[i]|0x0100;
busy();
}
/*****the forth line *****/
READS=0x00d4|0x0400;
busy();
READS=0x00d4|0x0000;
busy();
for(i=0;i<15;i++)
{
READS=char4[i]|0x0500;
busy();
READS=char4[i]|0x0100;
busy();
}
}
interrupt void tint0()
{
time1_over=1;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -