arm 力天电子 lpc2148无字库12864的万年历

发布者:糖果龙猫最新更新时间:2019-05-20 来源: eefocus关键字:arm  lpc2148  万年历 手机看文章 扫描二维码
随时随地手机看文章

#include


//管脚宏定义

#define  SCLK 0x01<<24  //595时钟端

#define  MISO 0x01<<5   //数据输入端

#define  MOSI 0x01<<6   //数据输出端

#define  RCK  0x01<<7   //SO12864时钟输入端


//LCD Define 

#define LCD_A 1<<30  //命令数据选择端,高电平:数据  低电平:命令

#define LCD_CLK 1<<4 //时钟端

#define LCD_DATA MOSI //数据端

#define B_LED   1<<13 //背光


#define Sclk_L() IO0CLR |=LCD_CLK //时钟高电平

#define Sclk_H() IO0SET |=LCD_CLK //时钟低电平

#define Res_L()  HC595_DATA &=~(1<<2);Write595() //复位低电平

#define Res_H()  HC595_DATA |=(1<<2); Write595() //复位高电平

#define Data_L() IO0CLR |=LCD_DATA //数据低电平

#define Data_H() IO0SET |=LCD_DATA //数据高电平

#define CS_L() HC595_DATA &=~1; Write595() //片选低电平

#define CS_H() HC595_DATA |=1;  Write595() //片选高电平

#define Write_C() IO0CLR |=LCD_A //选择写命令

#define Write_D() IO0SET |=LCD_A //选择写数据

#define Writecommand

//#define pgm_read_byte

//#define LcdCls

#define Fosc            11059200  

#define Fcclk           (Fosc * 4) 

#define Fpclk           (Fcclk / 4) * 1


 unsigned int  datas;

 unsigned int  times;

 unsigned int  bak;


//函数声明

void Delayn(unsigned long n);

void Write595();

void HC595_Init(void);

void Lcd_Init(void);

void Lcd_display_HZ(unsigned char x,unsigned char y,unsigned char *p);

void LcdCls(unsigned char data);

void Setxy(unsigned char x,unsigned char y);

void show_string1616(unsigned char x,unsigned char y,unsigned *string,unsigned char string_lenth);

void RTCInit (void);

void SendTimeRtc(void);

void LcdShow1216(unsigned char x,unsigned char y,unsigned char *p);

//全局变量

unsigned int HC595_DATA=0xFFFFFFFF;

unsigned int title[]={19,19,8,20,21};//"小小日历钟",取的值是由模中各个字所在的位置决定的

unsigned char HZ[][32]=

{{0x20,0x24,0x24,0x24,0xFE,0x23,0x22,0x20,0xFF,0x20,0x22,0xAC,0x20,0x30,0x20,0x00,

0x00,0x08,0x48,0x84,0x7F,0x02,0x21,0x10,0x09,0x06,0x1A,0x61,0x80,0xE0,0x00,0x00},  //"我"(0)

{0x00,0xFC,0xFC,0x84,0x84,0xFE,0xFE,0x14,0x90,0x10,0x10,0xFF,0xFF,0x10,0x18,0x00,

0x00,0x3F,0x1F,0x10,0x10,0x3F,0x3F,0x00,0x00,0x23,0x60,0xFF,0x7F,0x00,0x00,0x00},  //时(1)

{0x40,0x20,0xF8,0x07,0x40,0x20,0x18,0x0F,0x08,0xC8,0x08,0x08,0x28,0x18,0x00,0x00,

0x00,0x00,0xFF,0x00,0x00,0x08,0x04,0x43,0x80,0x7F,0x00,0x01,0x06,0x0C,0x00,0x00},  //"你"(2)

{0x00,0x20,0x18,0xCF,0xC7,0x44,0x44,0xFC,0xFC,0x44,0x44,0x64,0x46,0x04,0x00,0x00,

0x04,0x04,0x04,0x07,0x07,0x04,0x04,0xFF,0xFF,0x04,0x04,0x04,0x04,0x06,0x04,0x00},  //年(3)

{0x00,0x00,0x00,0x00,0xFF,0xFE,0x22,0x22,0x22,0x22,0x22,0xFF,0xFE,0x04,0x00,0x00,

0x00,0x80,0x40,0x70,0x1F,0x07,0x02,0x02,0x02,0x42,0x42,0xFF,0x7F,0x00,0x00,0x00},  //月(4)

{0x10,0x90,0xFF,0x50,0x98,0xC8,0x48,0xC8,0x48,0x7F,0x48,0xC8,0x48,0xEC,0x48,0x00,

0x02,0x01,0xFF,0x00,0x00,0xFF,0x10,0x12,0x13,0x7E,0x13,0x52,0x90,0x7F,0x00,0x00}, //"楠"(5)

{0x00,0x42,0x82,0x02,0x02,0xFE,0x02,0x02,0x02,0xFE,0x02,0x02,0xC3,0x82,0x00,0x00,

0x40,0x40,0x41,0x46,0x40,0x7F,0x40,0x40,0x40,0x7F,0x44,0x43,0x40,0x60,0x40,0x00}, //"亚"(6)

{0x40,0xB0,0x92,0x96,0x9A,0x92,0xF2,0x9E,0x92,0x91,0x99,0x95,0x91,0x50,0x30,0x00,

0x00,0x00,0x40,0x30,0x8C,0x83,0x46,0x2A,0x12,0x2A,0x26,0x42,0xC0,0x40,0x00,0x00}, //"爱"(7)

{0x00,0x00,0x00,0xFE,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0xFF,0x02,0x00,0x00,0x00,

0x00,0x00,0x00,0x7F,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7F,0x00,0x00,0x00,0x00}, //"日"(8)

{0x00,0xFC,0x84,0x84,0x84,0xFE,0x14,0x10,0x90,0x10,0x10,0x10,0xFF,0x10,0x10,0x00,

0x00,0x3F,0x10,0x10,0x10,0x3F,0x00,0x00,0x00,0x23,0x40,0x80,0x7F,0x00,0x00,0x00}, //"时"(9)

{0x00,0x80,0x40,0x20,0x98,0x86,0x80,0x80,0x83,0x8C,0x90,0x20,0xC0,0x80,0x80,0x00,

0x01,0x00,0x80,0x40,0x20,0x1F,0x00,0x40,0x80,0x40,0x3F,0x00,0x00,0x01,0x00,0x00}, //"分"(10)

{0x20,0x24,0x24,0xA4,0xFE,0xA3,0x22,0x80,0x70,0x00,0xFF,0x00,0x10,0x20,0x60,0x00,

0x10,0x08,0x06,0x01,0xFF,0x00,0x81,0x80,0x40,0x20,0x17,0x08,0x04,0x03,0x00,0x00}, //"秒"(11)

{0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xC0,0x80,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, //"一"(12)

{0x40,0x48,0x48,0x48,0xFF,0x48,0x48,0x00,0xC4,0x44,0x44,0x44,0xFE,0x04,0x00,0x00,

0x40,0x20,0x1F,0x20,0x7F,0x42,0x42,0x40,0x47,0x48,0x48,0x48,0x48,0x6E,0x20,0x00}, //"起"(13)

{0x00,0x04,0x24,0x24,0x24,0x24,0x24,0xFC,0x22,0x22,0x22,0x33,0x22,0x00,0x00,0x00,

0x02,0x02,0x02,0x02,0x02,0x42,0x82,0x7F,0x02,0x02,0x02,0x02,0x02,0x03,0x02,0x00}, //"手"(14)

{0x10,0x10,0x10,0xFF,0x90,0x50,0x08,0xE8,0x09,0x0E,0x08,0x08,0xEC,0x08,0x00,0x00,

0x02,0x42,0x81,0x7F,0x00,0x40,0x40,0x40,0x4F,0x60,0x58,0x47,0x40,0x60,0x40,0x00}, //"拉"(15)

{0x40,0x20,0xF8,0x07,0x00,0xF8,0x02,0x04,0x08,0x04,0x04,0x04,0x04,0xFE,0x04,0x00,

0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x7F,0x00,0x00}, //"们"(16)

{0x40,0x40,0x48,0x48,0x48,0x48,0x7F,0xC8,0x4C,0x68,0x50,0x48,0x4C,0x60,0x40,0x00,

0x40,0x20,0x10,0x08,0x04,0x7E,0x91,0x90,0x88,0x88,0x84,0x86,0x80,0xE0,0x00,0x00}, //"老"(17)

{0x00,0x84,0xC9,0x22,0x06,0x80,0x7E,0x12,0x32,0x52,0x9F,0x52,0x32,0x0A,0x06,0x00,

0x04,0x04,0x87,0x84,0x4D,0x54,0x26,0x24,0x26,0x55,0x4C,0x85,0x06,0x06,0x04,0x00}, //"婆"(18)

{0x00,0x00,0x00,0x00,0x80,0x60,0x00,0xFF,0x00,0x20,0x40,0x80,0x00,0x00,0x00,0x00,

0x00,0x08,0x04,0x02,0x01,0x40,0x80,0x7F,0x00,0x00,0x00,0x00,0x01,0x06,0x00,0x00}, //"小"(19)

{0x00,0x00,0xFE,0x42,0x42,0x42,0x42,0xFE,0x42,0x42,0x42,0x42,0x43,0xE2,0x40,0x00,

0x40,0x30,0x0F,0x80,0x40,0x20,0x18,0x07,0x00,0x20,0x40,0x80,0x40,0x3F,0x00,0x00}, //"历"(20)

{0x80,0x40,0x70,0xCF,0x48,0x48,0x00,0xF0,0x10,0x10,0xFF,0x10,0x10,0xF8,0x10,0x00,

0x02,0x02,0x02,0x7F,0x22,0x12,0x00,0x07,0x02,0x02,0xFF,0x02,0x02,0x07,0x00,0x00}, //"钟"(21)

}; 

unsigned  char num1216[][24]=  //下面的字模怎么得到的? 畔畔字模软件里面没有1216点阵的数字

{


{0x00,0xFC,0xFE,0x06,0x06,0x86,0x46,0x26,0x16,0xFE,0xFC,0x00,0x00,0x3F,0x7F,0x68,0x64,0x62,

0x61,0x60,0x60,0x7F,0x3F,0x00},//0

{0x00,0x00,0x00,0x00,0x08,0xFE,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,

0x7F,0x00,0x00,0x00,0x00,0x00}, //1

{0x00,0x3C,0x3E,0x06,0x06,0x06,0x06,0x86,0xC6,0x7E,0x3C,0x00,0x00,0x60,0x70,0x78,0x6C,0x66,

0x63,0x61,0x60,0x60,0x60,0x00}, //2

{0x00,0x3C,0x3E,0x06,0x06,0xC6,0xC6,0xC6,0xC6,0xFE,0x3C,0x00,0x00,0x3C,0x7C,0x60,0x60,0x60,

0x60,0x60,0x60,0x7F,0x3F,0x00}, //3

{0x00,0x00,0x80,0xE0,0x78,0x1E,0x06,0xFE,0xFE,0x00,0x00,0x00,0x00,0x1E,0x1F,0x19,0x18,0x18,

0x18,0x7F,0x7F,0x18,0x18,0x00}, //4

{0x00,0xFE,0xFE,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x86,0x00,0x00,0x3C,0x7C,0x60,0x60,0x60,

0x60,0x60,0x60,0x7F,0x3F,0x00}, //5

{0X00,0xFC,0xFE,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xCE,0x8C,0x00,0x00,0x3F,0x7F,0x60,0x60,0x60,

0x60,0x60,0x60,0x7F,0x3F,0x00}, //6

{0x00,0x1E,0x1E,0x06,0x06,0x06,0x06,0x86,0xE6,0x7E,0x1E,0x00,0x00,0x00,0x00,0x00,0x60,0x78,

0x1E,0x07,0x01,0x00,0x00,0x00}, //7

{0x00,0x7C,0xFE,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xFE,0x7C,0x00,0x00,0x3F,0x7F,0x60,0x60,0x60,

0x60,0x60,0x60,0x7F,0x3F,0x00}, //8

{0x00,0xFC,0xFE,0x06,0x06,0x06,0x06,0x06,0x06,0xFE,0xFC,0x00,0x00,0x31,0x73,0x63,0x63,0x63,

0x63,0x63,0x63,0x7F,0x3F,0x00}, //9

{0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x01,0x01,0x01,0x01,0x01,

0x01,0x01,0x01,0x01,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}, //space

{0x00,0x00,0x00,0x00,0x18,0x3C,0x3C,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00}, //.


}; 

//主函数

int main(void)

{

  HC595_Init(); //初始化74HC595

  IO0DIR |=LCD_A|B_LED|LCD_CLK; //初始化IO口

  Lcd_Init(); //初始化液晶屏

  LcdCls(0x00);//清屏

  Delayn(10000000);

  RTCInit();

  show_string1616(16,0,title,5);

  while(1)

  {

    while(0==(ILR&0x01));

    ILR=0x01;

    SendTimeRtc();

  }

}

//初始化595接口

void HC595_Init(void)

{

  IO0DIR |= MOSI|RCK;

  IO1DIR |= SCLK;

  IO1CLR |= SCLK;

  IO0DIR |= RCK;

  HC595_DATA =0xFFFFFFFF;Write595();

}

//写字节

void WriteByte(unsigned char data)

{

  unsigned char i;

  //IO0CLR;

  for(i=0;i<8;i++)

  {

    if(data&0x01) IO0SET=MOSI;

    else IO0CLR =MOSI;

    IO1SET=SCLK;

    data>>=1;

    IO1CLR=SCLK;

  }

    //IO0SET=RCK;

}

 //刷新595的数据

void Write595()

{

  IO0CLR=RCK;

  WriteByte(HC595_DATA&0xff);

  WriteByte((HC595_DATA&0xff00)>>8);

  WriteByte((HC595_DATA&0xff0000)>>16);

  WriteByte((HC595_DATA&0xff000000)>>24);

  IO0SET=RCK;

}

//延时周期数

void Delayn(unsigned long n)

{

while(n--);

}

//向SPI总线上写一个字节的数据

void LCDWriteByte(unsigned char data)

{

  unsigned char i,s;

  s=data;

  for(i=0;i<8;i++)

  { //Delayn(1000000); //自己加的

    if(s&0x80) Data_H();

    else  Data_L();

    Sclk_H();

    s<<=1;

    Sclk_L(); 

  }

}

//向液晶屏写数据

void WriteData(unsigned char Data)

{

  Write_D();

  CS_L();

  LCDWriteByte(Data);

  CS_H();

}

//向液晶屏写命令

void WriteCommand(unsigned char Command)

{

  Write_C();

  CS_L();

  LCDWriteByte(Command);

  CS_H();

}

//打开液晶背光  0:关闭 1:打开

void Lcd_BackLed(unsigned char on)

{

  if(on==1)

  {

    IO0CLR=B_LED; //打开背光

  }

  else if(on==0)

  {

    IO0SET=B_LED; //关闭背光

  }

}

//液晶复位

void Lcd_Reset(void)

{

  Res_L();

  Delayn(10000000);

  Res_H();

}

//列顺序翻转,左右翻转 0:正常 1:翻转

void Lcd_ColRev(unsigned char i)

{

  WriteCommand(0xa0|(i&0x01));

}

//清屏

void LcdCls(unsigned char data)

{

  unsigned char i,j;

  for(i=0;i<9;i++)

  {

    Setxy(0,i);

    for(j=0;j<128;j++)

    {

      WriteData(data);

    } 

  }

}

//液晶初始化

void Lcd_Init(void)

{

  Lcd_Reset();    //液晶复位

  //Lcd_BackLed(0);

  Lcd_BackLed(1); //打开液晶背光

[1] [2]
关键字:arm  lpc2148  万年历 引用地址:arm 力天电子 lpc2148无字库12864的万年历

上一篇:串口调试助手出现乱码
下一篇:arm 力天电子lpc2148无字库12864显示多行多个汉字(串行)

推荐阅读最新更新时间:2024-11-02 12:23

基于嵌入式ARM9的USB设计与实现
引 言 USB(Universal Serial Bus)是通用串行总线的缩写,因其具有方便易用,动态分配带宽,容错性优越和高性价比等特点,现已成为计算机的主流接口。 随着嵌入式系统的广泛应用,各种小型终端需要开发出与外界联系的USB接口。目前,常用的技术有两种。基于单片机的USB接口,特点是需要外置芯片,电路复杂,留下的CPU资源不多;基于ARM的USB接口,特点是资源丰富,但ARM系列产品较多,如果选型不当,还需要搭接较多的外围电路,且不能很好地发挥CPU性能。 该设计采用三星公司ARM9核的S3C2440A芯片作为CPU,因为该芯片内部集成了控制USB的所有部件,外围电路简单,易于实现。 1 S3C2440A特
[单片机]
基于嵌入式<font color='red'>ARM</font>9的USB设计与实现
ARM9微控制器LPC3180的软硬件平台设计
摘要 介绍以Philips LPC3180微控制器为核心的嵌入式软硬件平台设计;对系统设计的硬件部分和软件部分进行详细的分析,并针对LPC3180芯片特性着重讨论了其软件系统构建以及系统启动流程。实验结果表明,LPC3180嵌入式系统平台结合片内硬件浮点运算单元,具有高性能的浮点运算处理能力,可满足复杂的嵌入式应用场合的要求。 关键词 LPC3180 ARM9 软硬件平台 嵌入式应用系统设计包括硬件平台和软件平台两部分。前者是以嵌入式微控制器/微处理器为核心的硬件系统;后者则是围绕嵌入式操作系统构建的软件系统。两者在设计上是密不可分的,并且需要在设计之间进行权衡优化,根据实际应用进行外扩和裁剪。 基于ARM92
[单片机]
基于LPC2148设计的微型快速尿液分析仪系统
项目背景及可行性分析 项目名称、项目的主要内容及目前的进展情况 项目关键技术及创新点的论述; 技术成熟性和可靠性论述: 项目名称:基于CCD的微型快速尿液分析仪的设计 主要内容: 现有的自动化尿液分析仪往往具有体积大、价格高、检测时间长的不足,随着国民经济和人们生活水平的提高,普通百姓对家用医疗仪器的需求正不断增长。因此, 我们有必要设计一种基于嵌入式的便携式微型尿液分析仪,具有体积小、价格低、检测方便快速的优点,满足广大家庭用户的健康需要。该尿液分析仪具有广阔的市场前 景。 在用户把浸没了尿液的试纸条放入仪器后,通过LPC2148控制LED光源进行分时发光,然后反射光通过光纤照射到CCD上,经过信号的采集和模数转换,并
[单片机]
基于<font color='red'>LPC2148</font>设计的微型快速尿液分析仪系统
使用SPCE061A的ACM12864J液晶显示模块应用设计
0. 引言 点阵式平板图形液晶显示器在各种便携式产品中具有非常广泛的应用。显示器的核心液晶显示器控制器品种繁多,各种控制芯片在控制电路逻辑、控制指令、指标参数等方面各有差异。但是对于已经带有控制电路的平板点阵式图形液晶显示器,使用者无需关心其控制核心的集成芯片,控制电路的几个信号,就可以方便地利用它进行开发。 1. ACM12864J液晶显示模块的特性 ACM12864J是采用联合电子公司生产的小型液晶显示模块,该模块价格低,数据可读写,自带负压发生电路,单+5V供电,带背光,可由各种微控制器器直接控制,数据读写操作不受外部时钟控制,不带汉字库,占空比为1/64,外部共有20条引脚来进行外部接口。 ACM12864J采
[单片机]
使用SPCE061A的ACM<font color='red'>12864</font>J液晶显示模块应用设计
Python2.5.4移植到arm-linux
1 移植需求 需求:在Arm9上运行python2.5.4。 ARM Target环境: S3C2410A & arm-linux-2.4.18,和 AT91SAM9261 & arm-linux-2.6.20。 host编译环境: RHEL5U3, gcc 4.1.2, arm-linux-gcc 2.95.3,arm-linux-gcc 3.4.4 需要cross compile的软件包: sqlite 3.6.14, python 2.5.4, boa-0.94.13. 2 交叉编译sqlite 先到 http://www.sqlite.org/download.html 下载最新的sqlite源
[单片机]
基于AVR单片机的万年历程序设计
AVR单片机万年历程序 //***************************FileName:RTC.C************************// //***************************ICCAVRV6.30编译**********************// #include// 寄存器 定义文件 #include//使用到宏 #defineucharunsignedchar//数据类型定义 #defineuintunsignedchar//数据类型定义 #defineSD23030x64//SD2303器件IIC识别码 ucharTable[12]={0x3f,0x06,0x5b,
[单片机]
基于AVR单片机的<font color='red'>万年历</font>程序设计
ARM处理器及ARM处理器工作模式
简介:ARM微处理器的工作状态一般有两种,并可在两种状态之间切换: 第一种为ARM状态,此时处理器执行32位的字对齐的ARM指令; 第二种为Thumb状态,此时处理器执行16位的、半字对齐的Thumb指令。 ARM处理器状态 ARM微处理器的工作状态一般有两种,并可在两种状态之间切换: 第一种为ARM状态,此时处理器执行32位的字对齐的ARM指令; 第二种为Thumb状态,此时处理器执行16位的、半字对齐的Thumb指令。 在程序的执行过程中,微处理器可以随时在两种工作状态之间切换,并且,处理器工作状态的转变并不影响处理器的工作模式和相应寄存器中的内容。但ARM微处理器在开始执行代码时,应该处于ARM状态。 ARM处理
[单片机]
飞思卡尔推出带ARM DS5的Vybrid控制器方案
飞思卡尔具备定制ARM® Development Studio 5的Vybrid控制器解决方案现已供货,新的开发环境在单一封装中支持异构ARM内核,加速软件开发和调试流程 飞思卡尔半导体(NYSE:FSL)现已推出带ARM® Development Studio 5 (DS-5™)开发环境的Vybrid控制器解决方案,简化了需要丰富的人机界面(HMI)和连接性、以及确定性实时控制和响应功能的传统复杂应用的开发。飞思卡尔Vybrid控制器解决方案在一个非对称多处理架构平台上构建,充分利用了飞思卡尔作为微控制器开发和多核设计领域领导者的丰富经验。 ARM DS-5工具链在飞思卡尔塔式系统中提供,以便为Vybrid器件中的两个ARM
[嵌入式]
小广播
设计资源 培训 开发板 精华推荐

最新单片机文章
何立民专栏 单片机及嵌入式宝典

北京航空航天大学教授,20余年来致力于单片机与嵌入式系统推广工作。

换一换 更多 相关热搜器件

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved