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

#include <NXP/iolpc2148.h>

//管脚宏定义
#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,0x
  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
/*-----------------------------------------------------------*/ #define LCD_OFF 0x3E #define LCD_ON 0x3F #define Add_X 0xB8 //the start address of the page 0 ;(0~7) #define Add_Y 0x40 //the start address of the Y counter ; (0~64) #define Add_Z 0xC0 //the start address of the DDRAM ; (0~64) #define UPLINE 0x01 #define UNDERLINE 0x80 /*-----------------------------------------------------------*/ #define LCD12864_DATA_PORT P0 sbit LCD12864_EN =P1^4; sbit LCD12864_RW =P1^3; //0:write ; 1:read sbit LCD12864_RS =P1^2; //0:the command .1:the data sbit LCD12864_CS_L =P1^1; //select the left of the lcd when 1 sbit LCD12864_CS_R =P1^0; sbit LCD12864_RST =P1^5; /*------------------------------------------------------------*/ void delayus(unsigned int us) { while(us--); } void delayms(unsigned ms) { unsigned int i,j; for (i=0;i<ms;i++) { for (j=0;j<1000;j++) ; } } /*--------------------------select the LCD--------------------*/ void LCDSel(unsigned char sel) { switch(sel) { case 0: LCD12864_CS_L=0;LCD12864_CS_R=0;break; case 1: LCD12864_CS_L=1;LCD12864_CS_R=0;break; //left case 2: LCD12864_CS_L=0;LCD12864_CS_R=1;break; //right default:; }; } /*------------------------------------------------------------*/ void WaitLCD() { unsigned char flag; LCD12864_DATA_PORT=0xFF; LCD12864_RW=1; LCD12864_RS=0; LCD12864_EN=1; LCD12864_EN=1; LCD12864_EN=0; LCD12864_DATA_PORT=0xFF; //读有效数据 LCD12864_RW=1; LCD12864_RS=0; ; LCD12864_EN=1; do { flag=LCD12864_DATA_PORT; LCD12864_DATA_PORT=0xFF; }while(!((flag&0x80)==0x80)); LCD12864_EN=0; } //*/ /*-------------------------------------------------------------*/ void WriteDatToLCD12864(unsigned char dat) { WaitLCD(); LCD12864_RS=1; //the data LCD12864_RW=0; //write LCD12864_DATA_PORT=dat; LCD12864_EN=1; ; LCD12864_EN=0;
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值