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

📄 main.c

📁 力天电子 dsp源码
💻 C
📖 第 1 页 / 共 2 页
字号:
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x04,0x02,0x02,0x01,0x00,0x00,
0x00,0x02,0x04,0x0C,0x04,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x04,0x02,
0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x06,0x06,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x04,0x04,0x04,0x04,0x04,0x04,0x07,
0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x0C,0x07,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x50,
0x90,0x10,0x10,0x10,0xF0,0x30,0x00,0x80,0x70,0x4C,0xC0,0x40,0x40,0xC0,0x60,0x40,
0x00,0x00,0x00,0x00,0x00,0x0C,0x98,0x00,0x00,0xF0,0x10,0x08,0x08,0x04,0xF0,0x10,
0x10,0x10,0xF0,0x00,0x00,0x00,0x00,0x80,0x40,0x20,0xFC,0x04,0x40,0x20,0x98,0x1C,
0x34,0xD0,0x10,0x10,0x50,0x30,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,
0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xC0,0x21,0x1A,0x0E,0x39,0xE0,0x02,0x81,0x40,0x38,0x07,0x38,0xC0,0x01,0x00,0x00,
0x00,0x00,0x00,0x00,0x81,0x41,0x7F,0x80,0x00,0x3F,0x10,0x08,0x00,0x00,0xFF,0x00,
0x20,0x20,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x0F,0x00,0xE4,0x02,0x11,0x68,
0x48,0x0F,0x00,0xC0,0x21,0x46,0xC4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xCF,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
0x00,0x00,0x00,0x00,0x04,0x02,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x02,
0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x01,0x01,0x02,0x02,0x02,0x02,0x02,0x02,
0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x03,0x04,0x04,0x04,
0x04,0x04,0x04,0x03,0x02,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};    

/****************函数声明*******************/ 
void Init_SO12864(void);
void WR_SO12864(unsigned char dat_comm,unsigned char content);
void Clr_RAM(void);
void Disp_Image(const unsigned char *image);
void Disp_Chinese(unsigned char page,unsigned char column,const unsigned char *tab);
void Disp_Char(unsigned char page,unsigned char column,const unsigned char *tab); 

/*------------------------------------------*/
/*形式参数:void                            */
/*返回值:void				                */
/*函数描述:主函数			                */
/*------------------------------------------*/ 
void main(void)
{
	InitSysCtrl();  // 系统初始化子程序,在DSP28_sysctrl.c中 
	Init_SO12864();
	Disp_Char(1,8,tab17);//显示字符
	Disp_Char(1,16,tab17);
	Disp_Char(1,24,tab17);
	Disp_Char(1,32,tab18);
	Disp_Char(1,36,tab1);
	Disp_Char(1,44,tab3);
	Disp_Char(1,52,tab16);
	Disp_Char(1,60,tab15);
	Disp_Char(1,68,tab14);
	Disp_Char(1,76,tab18);
	Disp_Char(1,80,tab8);
	Disp_Char(1,88,tab9);
	Disp_Char(1,96,tab10);
	Clr_RAM();//清屏
	Disp_Chinese(1,8,China1);//显示汉字
	Disp_Chinese(1,24,China2);
	Disp_Chinese(1,40,China3);
	Disp_Chinese(1,56,China4);
	Disp_Chinese(1,72,China5);
	Disp_Chinese(1,88,China6);
	Disp_Chinese(1,104,China7);
	Disp_Chinese(1,120,China8);
	Clr_RAM();//清屏
  	Disp_Image(image1);
	while(1);  
} 

/*------------------------------------------*/
/*形式参数:void                            */
/*返回值:void				                */
/*函数描述:初始化SO12864					*/
/*------------------------------------------*/  
void Init_SO12864(void)
{ 
  unsigned int i;
  EALLOW;   //设置液晶对应端口输出
  SO12864_RES_DIR=1;  
  SO12864_A0_DIR=1;  
  SO12864_SCL_DIR=1;   
  SO12864_SI_DIR=1;
  EDIS;
  SO12864_RES_OUT=0; //复位
  for(i=1000;i>0;i--);
  SO12864_RES_OUT=1; //复位完成
  WR_SO12864(comm,0xAE);  /*Display ON/OFF 0xae:OFF 0xaf:ON*/
  WR_SO12864(comm,0xA2);  /*LCD bias set 0xa2:1/9 0xa3:1/7*/
  WR_SO12864(comm,0xA1);  /*ADC select 0xa0:0-127 0xa1:127-0*/
  WR_SO12864(comm,0xC0);  /*ADC select 0xc0:0-63 0xc8:63-0*/
  WR_SO12864(comm,0xE0);
  WR_SO12864(comm,0x26); 
  WR_SO12864(comm,0x81);  
  WR_SO12864(comm,0x0A);  
  WR_SO12864(comm,0x2C);  
  WR_SO12864(comm,0x2F);  
  Clr_RAM();//清屏
  WR_SO12864(comm,0xAF);  /*Display ON/OFF 0xae:OFF 0xaf:ON*/
} 

/*------------------------------------------*/
/*形式参数:dat_comm--指令或数据 content--内容*/
/*返回值:void				                */
/*函数描述:写指令或数据子程序				*/
/*------------------------------------------*/ 
void WR_SO12864(unsigned char dat_comm,unsigned char content)
{
  unsigned char i,j,temp;
  temp=content;
  if(dat_comm==0)
    SO12864_A0_OUT =0;
  else
    SO12864_A0_OUT =1;
  SO12864_SCL_OUT=0;
  for(i=0;i<8;i++)
  {
    if((temp&0x80)==0x80)
    {
      SO12864_SI_OUT=1;
    }
    else
    {
      SO12864_SI_OUT=0;
    }
	for(j=0;j<10;j++);
    SO12864_SCL_OUT=1;
	for(j=0;j<10;j++);
    SO12864_SCL_OUT=0;
	for(j=0;j<10;j++);
    temp<<=1;
  }
} 

/*------------------------------------------*/
/*形式参数:void							*/
/*返回值:void				                */
/*函数描述:清DDRAM							*/
/*------------------------------------------*/  
void Clr_RAM(void)
{ 
  unsigned char i,j,page;
  page=0xB0;
  for(i=0;i<8;i++)
  {
    WR_SO12864(comm,page);
    WR_SO12864(comm,0x10);
    WR_SO12864(comm,0x00);
    for(j=0;j<128;j++)
      WR_SO12864(dat,0x00);
    page++;
  }
} 

/*------------------------------------------*/
/*形式参数:*image--指向图片数据			*/
/*返回值:void				                */
/*函数描述:写图像子程序						*/
/*------------------------------------------*/ 
void Disp_Image(const unsigned char *image)
{ 
  unsigned char i,j,page;
  const unsigned char *temp=image;
  page=0xB0;
  for(i=0;i<8;i++)
  {
    WR_SO12864(comm,page);
    WR_SO12864(comm,0x10);
    WR_SO12864(comm,0x00);
    for(j=0;j<128;j++)
      WR_SO12864(dat,*(temp++));
    page++;
  } 
}

/*------------------------------------------*/
/*形式参数:*tab--指向汉字数据				*/
/*返回值:void				                */
/*函数描述:写汉字子程序						*/
/*------------------------------------------*/  
void Disp_Chinese(unsigned char page,unsigned char column,const unsigned char *tab)
{ 
  unsigned char i,j,least,most;
  const unsigned char *temp=tab;
  page |=0xB0;
  least=column&0x0F;
  column>>=4;
  most=column|0x10;
  for(i=0;i<2;i++)
  {
    WR_SO12864(comm,page);
    WR_SO12864(comm,most);
    WR_SO12864(comm,least);
    for(j=0;j<16;j++)
      WR_SO12864(dat,*(temp++));
    page++;
  } 
}
/*------------------------------------------*/
/*形式参数:*tab--指向字符数据				*/
/*返回值:void				                */
/*函数描述:写字符子程序 					*/
/*------------------------------------------*/ 
void Disp_Char(unsigned char page,unsigned char column,const unsigned char *tab)
{ 
  unsigned char i,j,least,most;
  const unsigned char *temp=tab;
  page |=0xB0;
  least=column&0x0F;
  column>>=4;
  most=column|0x10;
  for(i=0;i<2;i++)
  {
     WR_SO12864(comm,page);
     WR_SO12864(comm,most);
     WR_SO12864(comm,least);
     for(j=0;j<8;j++)
       WR_SO12864(dat,*(temp++));
     page++;
   } 
} 



 

⌨️ 快捷键说明

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