/******************************************************************************
* @file main.c
* @version V1.00
* $Revision: 3 $
* $Date: 14/01/28 11:45a $
* @brief Template project for M051 series MCU
*
* @note
* Copyright (C) 2014 Nuvoton Technology Corp. All rights LCD_RSTerved.
*****************************************************************************/
#include <stdio.h>
#include "M051Series.h"
#include "display.h"
#include "config.h"
#define PLL_CLOCK 50000000
/***********显示***************/
uint16_t IC_DAT2[]=
{
0XB9,0XE3, 0XCA,0XA1, 0xC9,0xEE, 0XDB,0XDA, 0XCA,0XD0, 0XB8,0XA3, 0XCC,0XEF, 0XC7,0XF8, //显示第一行:广东深圳市福田区
0x31,0x32, 0x38,0x36, 0x34,0x2D, 0XB4,0XF8, 0XD6,0XD0, 0XCE,0XC4, 0XD7,0XD6, 0XBF,0XE2, //显示第二行:12864-带中文字库
0XD6,0XD0, 0XCE,0XC4, 0XD7,0XD6, 0XBF,0XE2, 0XD2,0XBA, 0XBE,0XA7, 0XC4,0XA3, 0XBF,0XE9, //显示第三行:中文字库液晶模块
0X53,0X54, 0X37,0X39, 0X32,0X30, 0XBC,0XF2, 0XCC,0XE5, 0XBA,0XBA, 0XD7,0XD6, 0XBF,0XE2, //显示第四行:ST7920简体汉字库
};
uint16_t pic1[]=
{
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
0x82,0x00,0x02,0x61,0x08,0x24,0x00,0x80,0x20,0x40,0x00,0x00,0x42,0x40,0x86,0x01,
0x83,0x7F,0xC2,0x69,0x09,0xFF,0x00,0x80,0x34,0x64,0x3F,0xE0,0x42,0x50,0x84,0x01,
0x81,0x52,0x42,0x29,0x08,0x20,0x00,0x80,0x1F,0x98,0x20,0x20,0x4F,0xE0,0x9F,0xC1,
0x80,0x13,0x02,0x29,0x09,0xFE,0x00,0x80,0x01,0x20,0x3F,0xE1,0xF2,0x40,0x84,0xC1,
0x86,0x21,0x8F,0xA9,0x1F,0xA2,0x00,0x80,0x43,0x7C,0x20,0x20,0x4F,0xE3,0xE4,0xC1,
0x82,0x4C,0x02,0x29,0x09,0xFE,0x3F,0xFE,0x32,0x4C,0x3F,0xE0,0xCC,0x20,0x84,0xC1,
0x80,0x0C,0x02,0x69,0x09,0xA2,0x00,0x80,0x06,0xE8,0x00,0x00,0xEF,0xE0,0x84,0xC1,
0x80,0x7F,0xC2,0x69,0x09,0xFE,0x00,0x80,0x0E,0xE8,0x7D,0xF1,0xDF,0xE0,0xBF,0xE1,
0x81,0x1E,0x02,0x49,0x09,0xA4,0x00,0x80,0x33,0x58,0x45,0x11,0x41,0x00,0x86,0x01,
0x81,0x3F,0x0F,0x49,0x0B,0xFF,0x00,0x80,0x22,0x70,0x7D,0xF1,0x4F,0xF0,0xEF,0x01,
0x82,0x2D,0x88,0x49,0x08,0x04,0x00,0x80,0x22,0x30,0x45,0x10,0x41,0x83,0x89,0x01,
0x82,0xCC,0xC0,0xC9,0x08,0x44,0x00,0x80,0x22,0x78,0x7D,0xF0,0x42,0x40,0x10,0xC1,
0x86,0x0C,0x01,0x81,0x08,0x0C,0x1F,0xFC,0x63,0xCC,0x45,0x10,0x5C,0x30,0x60,0x61,
0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
0x80,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x60,0x08,0x00,0x00,0x80,0x01,0x00,0x01,
0x80,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x20,0x06,0xFE,0x00,0x80,0x3F,0xFC,0x01,
0x81,0x01,0xC3,0xC1,0xC1,0x80,0x10,0x00,0x20,0x00,0x42,0x3F,0xFE,0x22,0x00,0x01,
0x83,0x02,0x24,0x22,0x21,0x83,0xFF,0x8F,0xFF,0x80,0x46,0x20,0x06,0x21,0x00,0x01,
0x87,0x04,0x24,0x24,0x02,0x82,0x10,0x81,0x0C,0x1C,0x44,0x2F,0xF6,0x2F,0xF8,0x01,
0x81,0x04,0x24,0x25,0xC2,0x82,0x10,0x81,0x08,0x04,0x44,0x00,0x30,0x22,0x00,0x01,
0x81,0x00,0x43,0xC6,0x24,0x82,0x10,0x81,0x88,0x00,0x6C,0x00,0x60,0x24,0xC0,0x01,
0x81,0x00,0x84,0x24,0x28,0x83,0xFF,0x80,0x98,0x00,0x28,0x00,0x80,0x27,0xF8,0x01,
0x81,0x01,0x04,0x24,0x2F,0xC2,0x10,0x80,0xD0,0x0C,0x38,0x3F,0xFE,0x20,0xC0,0x01,
0x81,0x02,0x04,0x24,0x20,0x80,0x10,0x00,0x70,0x08,0x30,0x00,0x80,0x20,0xC0,0x01,
0x81,0x04,0x04,0x22,0x20,0x80,0x10,0x00,0xF0,0x08,0x68,0x00,0x80,0x6F,0xFC,0x01,
0x81,0x07,0xE3,0xC1,0xC0,0x80,0x10,0x03,0x8E,0x19,0xC6,0x00,0x80,0x40,0xC0,0x01,
0x80,0x00,0x00,0x00,0x00,0x00,0x10,0x0E,0x03,0x83,0x03,0x01,0x80,0x00,0xC0,0x01,
0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
0x87,0xC7,0xE4,0x00,0x01,0x07,0xE3,0xC1,0x03,0xC1,0xC1,0xC1,0x03,0xC7,0xE1,0x81,
0x81,0x04,0x04,0x00,0x03,0x04,0x04,0x23,0x04,0x22,0x22,0x23,0x04,0x20,0x21,0x81,
0x81,0x04,0x04,0x00,0x07,0x04,0x04,0x27,0x04,0x24,0x04,0x07,0x04,0x20,0x42,0x81,
0x81,0x04,0x04,0x01,0x01,0x07,0xC4,0x21,0x04,0x25,0xC5,0xC1,0x04,0x20,0x42,0x81,
0x81,0x07,0xC4,0x00,0x01,0x04,0x23,0xC1,0x03,0xC6,0x26,0x21,0x03,0xC0,0x44,0x81,
0x81,0x04,0x04,0x00,0x01,0x00,0x24,0x21,0x04,0x24,0x24,0x21,0x04,0x20,0x88,0x81,
0x81,0x04,0x04,0x00,0x01,0x00,0x24,0x21,0x04,0x24,0x24,0x21,0x04,0x20,0x8F,0xC1,
0x81,0x04,0x04,0x00,0x01,0x04,0x24,0x21,0x04,0x24,0x24,0x21,0x04,0x20,0x80,0x81,
0x81,0x04,0x04,0x00,0x01,0x04,0x24,0x21,0x04,0x22,0x22,0x21,0x04,0x21,0x00,0x81,
0x81,0x07,0xE7,0xE1,0x01,0x03,0xC3,0xC1,0x03,0xC1,0xC1,0xC1,0x03,0xC1,0x00,0x81,
0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
0x80,0x00,0x01,0x81,0x80,0x07,0xE3,0xC1,0x03,0x81,0x81,0x81,0x01,0xC0,0x00,0x01,
0x80,0x00,0x02,0x42,0x40,0x04,0x04,0x23,0x04,0x41,0x81,0x83,0x02,0x20,0x00,0x01,
0x80,0x00,0x04,0x24,0x20,0x04,0x04,0x27,0x04,0x22,0x82,0x87,0x04,0x00,0x00,0x01,
0x80,0x00,0x04,0x24,0x21,0x07,0xC0,0x21,0x04,0x22,0x82,0x81,0x05,0xC0,0x00,0x01,
0x80,0x00,0x04,0x24,0x20,0x04,0x20,0xC1,0x04,0x64,0x84,0x81,0x06,0x20,0x00,0x01,
0x80,0x00,0x04,0x24,0x20,0x00,0x20,0x21,0x03,0xA8,0x88,0x81,0x04,0x20,0x00,0x01,
0x80,0x00,0x04,0xA4,0xA0,0x00,0x20,0x21,0x00,0x2F,0xCF,0xC1,0x04,0x20,0x00,0x01,
0x80,0x00,0x04,0xA4,0xA0,0x04,0x24,0x21,0x04,0x20,0x80,0x81,0x04,0x20,0x00,0x01,
0x80,0x00,0x02,0x42,0x40,0x04,0x24,0x21,0x04,0x40,0x80,0x81,0x02,0x20,0x00,0x01,
0x80,0x00,0x01,0xA1,0xA1,0x03,0xC3,0xC1,0x03,0x80,0x80,0x81,0x01,0xC0,0x00,0x01,
0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
};
uint16_t pic2[]=
{
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x1F,0xFF,0x81,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x1F,0xFF,0x81,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x18,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x08,0x00,0x00,0x00,0x03,
0xC0,0x1F,0xFF,0x80,0x00,0x00,0x04,0x07,0x81,0xE0,0x10,0x10,0x03,0xC0,0x30,0x03,
0xC0,0x1F,0xFF,0x80,0x00,0x00,0x0C,0x0C,0xC3,0x30,0x08,0x20,0x0C,0xE0,0x70,0x03,
0xC0,0x18,0x01,0x87,0xFF,0xFE,0x3C,0x18,0x66,0x18,0x04,0x40,0x0C,0x60,0x70,0x03,
0xC0,0x1F,0xFF,0x87,0xFF,0xFE,0x0C,0x18,0x66,0x18,0x02,0x80,0x18,0x00,0xB0,0x03,
0xC0,0x1F,0xFF,0x80,0x06,0x00,0x0C,0x18,0x66,0x18,0x01,0x00,0x1B,0x81,0x30,0x03,
0xC0,0x01,0x98,0x00,0x06,0x00,0x0C,0x00,0xE3,0x30,0x02,0x80,0x1C,0xC1,0x30,0x03,
0xC0,0x19,0x99,0x80,0x66,0x60,0x0C,0x00,0xC1,0xE0,0x04,0x40,0x18,0x62,0x30,0x03,
0xC0,0x19,0x99,0x80,0x66,0x30,0x0C,0x01,0x83,0x30,0x08,0x20,0x18,0x66,0x30,0x03,
0xC0,0x0D,0x9B,0x00,0xC6,0x38,0x0C,0x03,0x06,0x18,0x10,0x10,0x18,0x67,0xFC,0x03,
0xC0,0x0D,0x9B,0x01,0xC6,0x1C,0x0C,0x06,0x06,0x18,0x20,0x08,0x18,0x60,0x30,0x03,
0xC0,0x01,0x98,0x03,0x86,0x0C,0x0C,0x0C,0x06,0x18,0x00,0x00,0x08,0x60,0x30,0x03,
0xC0,0x7F,0xFF,0xE3,0x06,0x00,0x0C,0x18,0x03,0x30,0x00,0x00,0x0C,0xC0,0x30,0x03,
0xC0,0x7F,0xFF,0xE0,0x1E,0x00,0x0C,0x1F,0xE1,0xE0,0x00,0x00,0x07,0x80,0x30,0x03,
0xC0,0x00,0x00,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x18,0x00,0x00,0x00,0x06,0x0C,0x03,
0xC3,0xFF,0xFC,0x3F,0xF0,0x80,0x0C,0x00,0x3F,0x18,0x01,0xFF,0xFE,0x06,0x0C,0x03,
0xC3,0xFF,0xFC,0x3F,0xF1,0x80,0x0F,0xFC,0x3F,0x18,0x01,0xFF,0xFE,0x06,0x0C,0x03,
0xC3,0x0C,0x0C,0x0C,0xC3,0x00,0x0F,0xFC,0x33,0x7F,0xE1,0x86,0x06,0x06,0x0C,0x03,
0xC3,0x1F,0xCC,0x0C,0xC6,0x00,0x0C,0x00,0x33,0x7F,0xE1,0x8F,0xE6,0x06,0x0C,0x03,
0xC3,0x3F,0xCC,0x0C,0xCC,0x00,0x0C,0x00,0x36,0x30,0x01,0x9F,0xE6,0x07,0xFF,0xE3,
0xC3,0x79,0x8C,0x0C,0xC8,0x00,0xFF,0xF0,0x36,0x36,0x01,0xBC,0xC6,0x07,0xFF,0xE3,
0xC3,0x6F,0x0C,0x7F,0xF0,0xC0,0xFF,0xF0,0x36,0x66,0x01,0xB7,0x86,0x06,0x00,0x03,
0xC3,0x0F,0x0C,0x7F,0xF1,0x80,0xC0,0x30,0x36,0x7F,0xC1,0x87,0x86,0x06,0x00,0x03,
0xC3,0x79,0xEC,0x0C,0xC3,0x00,0xC0,0x30,0x33,0x7F,0xC1,0xBC,0xF6,0x06,0x00,0x03,
0xC3,0x76,0xEC,0x0C,0xC6,0x00,0xC0,0x30,0x33,0x06,0x01,0xBB,0x76,0x07,0xFF,0x03,
0xC3,0x07,0x0C,0x0C,0xCC,0x20,0xFF,0xF0,0x33,0x06,0x01,0x83,0x86,0x07,0xFF,0x03,
0xC3,0x03,0x0C,0x18,0xC8,0x60,0xFF,0xF0,0x3F,0x06,0x01,0x81,0x86,0x06,0x03,0x03,
0xC3,0x1C,0x0C,0x18,0xC0,0xC0,0x00,0x00,0x3E,0xFF,0xE1,0x8E,0x06,0x06,0x03,0x03,
0xC3,0x1F,0x0C,0x18,0xC1,0x81,0xB1,0x8C,0x30,0xFF,0xE1,0x8F,0x86,0x06,0x03,0x03,
0xC3,0x03,0x0C,0x30,0xC7,0x01,0xB1,0x8C,0x30,0x06,0x01,0x81,0x86,0x0C,0x03,0x03,
0xC3,0xFF,0xFC,0x70,0xDE,0x03,0x18,0xC6,0x30,0x06,0x01,0xFF,0xFE,0x0C,0x03,0x03,
0xC3,0xFF,0xFC,0x20,0x18,0x03,0x18,0xC6,0x30,0x06,0x01,0xFF,0xFE,0x18,0x03,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
};
uint16_t pic3[]=
{
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC3,0x02,0x0E,0x1C,0x08,0xF8,0x67,0xE3,0x87,0x0C,0x08,0x38,0x70,0x23,0xE1,0x83,
0xC4,0x8E,0x11,0x22,0x18,0x80,0x90,0x24,0x48,0x92,0x38,0x44,0x88,0x62,0x02,0x43,
0xC8,0x42,0x11,0x22,0x28,0x81,0x00,0x24,0x48,0xA1,0x08,0x44,0x88,0xA2,0x04,0x03,
0xC8,0x42,0x01,0x02,0x28,0xF1,0xE0,0x44,0x48,0xA1,0x08,0x04,0x08,0xA3,0xC7,0x83,
0xC8,0x42,0x02,0x0C,0x48,0x89,0x10,0x43,0x88,0xA1,0x08,0x08,0x31,0x22,0x24,0x43,
0xC8,0x42,0x04,0x02,0x88,0x09,0x10,0x44,0x47,0xA1,0x08,0x10,0x0A,0x20,0x24,0x43,
0xC8,0x42,0x08,0x22,0xFC,0x89,0x10,0x44,0x40,0xA1,0x08,0x20,0x8B,0xF2,0x24,0x43,
0xC4,0x82,0x10,0x22,0x08,0x89,0x10,0x84,0x49,0x12,0x08,0x40,0x88,0x22,0x24,0x43,
0xC3,0x02,0x1F,0x1C,0x08,0x70,0xE0,0x83,0x86,0x0C,0x08,0x7C,0x70,0x21,0xC3,0x83,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xCF,0xC7,0x0E,0x18,0x10,0x70,0xE0,0x47,0xC3,0x3F,0x1C,0x38,0x60,0x41,0xC3,0x83,
0xC0,0x48,0x91,0x24,0x70,0x89,0x10,0xC4,0x04,0x81,0x22,0x44,0x91,0xC2,0x24,0x43,
0xC0,0x48,0x91,0x42,0x10,0x89,0x11,0x44,0x08,0x01,0x22,0x45,0x08,0x42,0x24,0x43,
0xC0,0x88,0x91,0x42,0x10,0x08,0x11,0x47,0x8F,0x02,0x22,0x45,0x08,0x40,0x20,0x43,
0xC0,0x87,0x11,0x42,0x10,0x10,0x62,0x44,0x48,0x82,0x1C,0x45,0x08,0x40,0x41,0x83,
0xC0,0x88,0x8F,0x42,0x10,0x20,0x14,0x40,0x48,0x82,0x22,0x3D,0x08,0x40,0x80,0x43,
0xC0,0x88,0x81,0x42,0x10,0x41,0x17,0xE4,0x48,0x82,0x22,0x05,0x08,0x41,0x04,0x43,
0xC1,0x08,0x92,0x24,0x10,0x81,0x10,0x44,0x48,0x84,0x22,0x48,0x90,0x42,0x04,0x43,
0xC1,0x07,0x0C,0x18,0x10,0xF8,0xE0,0x43,0x87,0x04,0x1C,0x30,0x60,0x43,0xE3,0x83,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x8F,0x86,0x7E,0x38,0x70,0xC0,0x83,0x87,0x02,0x3E,0x19,0xF8,0xE1,0xC3,0x03,
0xC1,0x88,0x09,0x02,0x44,0x89,0x23,0x84,0x48,0x86,0x20,0x24,0x09,0x12,0x24,0x83,
0xC2,0x88,0x10,0x02,0x44,0x8A,0x10,0x84,0x48,0x8A,0x20,0x40,0x09,0x12,0x28,0x43,
0xC2,0x8F,0x1E,0x04,0x44,0x8A,0x10,0x80,0x40,0x8A,0x3C,0x78,0x11,0x12,0x28,0x43,
0xC4,0x88,0x91,0x04,0x38,0x8A,0x10,0x80,0x83,0x12,0x22,0x44,0x10,0xE2,0x28,0x43,
0xC8,0x80,0x91,0x04,0x44,0x7A,0x10,0x81,0x00,0xA2,0x02,0x44,0x11,0x11,0xE8,0x43,
0xCF,0xC8,0x91,0x04,0x44,0x0A,0x10,0x82,0x08,0xBF,0x22,0x44,0x11,0x10,0x28,0x43,
0xC0,0x88,0x91,0x08,0x44,0x91,0x20,0x84,0x08,0x82,0x22,0x44,0x21,0x12,0x44,0x83,
0xC0,0x87,0x0E,0x08,0x38,0x60,0xC0,0x87,0xC7,0x02,0x1C,0x38,0x20,0xE1,0x83,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC1,0x07,0x0E,0x04,0x7C,0x33,0xF1,0xC3,0x86,0x04,0x1C,0x38,0x11,0xF0,0xCF,0xC3,
0xC7,0x08,0x91,0x0C,0x40,0x48,0x12,0x24,0x49,0x1C,0x22,0x44,0x31,0x01,0x20,0x43,
0xC1,0x08,0x91,0x14,0x40,0x80,0x12,0x24,0x50,0x84,0x22,0x44,0x51,0x02,0x00,0x43,
0xC1,0x00,0x81,0x14,0x78,0xF0,0x22,0x24,0x50,0x84,0x02,0x04,0x51,0xE3,0xC0,0x83,
0xC1,0x01,0x06,0x24,0x44,0x88,0x21,0xC4,0x50,0x84,0x04,0x18,0x91,0x12,0x20,0x83,
0xC1,0x02,0x01,0x44,0x04,0x88,0x22,0x23,0xD0,0x84,0x08,0x05,0x10,0x12,0x20,0x83,
0xC1,0x04,0x11,0x7E,0x44,0x88,0x22,0x20,0x50,0x84,0x10,0x45,0xF9,0x12,0x20,0x83,
0xC1,0x08,0x11,0x04,0x44,0x88,0x42,0x24,0x89,0x04,0x20,0x44,0x11,0x12,0x21,0x03,
0xC1,0x0F,0x8E,0x04,0x38,0x70,0x41,0xC3,0x06,0x04,0x3E,0x38,0x10,0xE1,0xC1,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
};
void SYS_Init(void)
{
/*---------------------------------------------------------------------------------------------------------*/
/* Init System Clock */
/*---------------------------------------------------------------------------------------------------------*/
/* Enable Internal RC 22.1184MHz clock */
CLK_EnableXtalRC(CLK_PWRCON_OSC22M_EN_Msk);
/* Waiting for Internal RC clock ready */
CLK_WaitClockReady(CLK_CLKSTATUS_OSC22M_STB_Msk);
/* Switch HCLK clock source to Internal RC and HCLK source divide 1 */
CLK_SetHCLK(CLK_CLKSEL0_HCLK_S_HIRC, CLK_CLKDIV_HCLK(1));
/* Enable external XTAL 12MHz clock */
CLK_EnableXtalRC(CLK_PWRCON_XTL12M_EN_Msk);
/* Waiting for external XTAL clock ready */
CLK_WaitClockReady(CLK_CLKSTATUS_XTL12M_STB_Msk);
/* Set core clock as PLL_CLOCK from PLL */
CLK_SetCoreClock(PLL_CLOCK);
/* Enable peripheral clock */
CLK->APBCLK = CLK_APBCLK_TMR0_EN_Msk | CLK_APBCLK_TMR1_EN_Msk | CLK_APBCLK_TMR2_EN_Msk | CLK_APBCLK_TMR3_EN_Msk | CLK_APBCLK_PWM01_EN_Msk |CLK_APBCLK_PWM23_EN_Msk;
/* Peripheral clock source */
CLK->CLKSEL1 = CLK_CLKSEL1_TMR0_S_HCLK | CLK_CLKSEL1_TMR1_S_HCLK | CLK_CLKSEL1_TMR2_S_HCLK | CLK_CLKSEL1_TMR3_S_HCLK | CLK_CLKSEL1_PWM01_S_HCLK | CLK_CLKSEL1_PWM23_S_HCLK;
/* Update System Core Clock */
/* User can use SystemCoreClockUpdate() to calculate PllClock, SystemCoreClock and CycylesPerUs automatically. */
SystemCoreClockUpdate();
}
void IIC_Init(void)
{
GPIO_SetMode(P3, BIT4, GPIO_PMD_QUASI); // SDA GPIO_PMD_QUASI
GPIO_SetMode(P3, BIT5, GPIO_PMD_QUASI); // SCL
I2C_SDA = 0;
I2C_SCL = 0;
}
void GPIO_Init(void)
{
/* 按键配置 */
GPIO_SetMode(P1, BIT6, GPIO_PMD_INPUT); // ON/OFF KEY
GPIO_SetMode(P1, BIT7, GPIO_PMD_INPUT); // RST KEY
/* 感应配置 */
GPIO_SetMode(P3, BIT2, GPIO_PMD_OPEN_DRAIN); // L_CHECK
GPIO_SetMode(P3, BIT3, GPIO_PMD_OPEN_DRAIN); // R_CHECK
/* 语音口配置 */
GPIO_SetMode(P3, BIT1, GPIO_PMD_INPUT); // PLAY_BUSY
GPIO_SetMode(P4, BIT3, GPIO_PMD_INPUT); // PLAY_RST
/* 数码管IO配置 */
GPIO_SetMode(P0, BIT0, GPIO_PMD_OUTPUT); //DB0
GPIO_SetMode(P0, BIT1, GPIO_PMD_OUTPUT); //DB1
GPIO_SetMode(P0, BIT2, GPIO_PMD_OUTPUT); //DB2
GPIO_SetMode(P0, BIT3, GPIO_PMD_OUTPUT); //DB3
GPIO_SetMode(P0, BIT4, GPIO_PMD_OUTPUT); //DB4
GPIO_SetMode(P0, BIT5, GPIO_PMD_OUTPUT); //DB5
GPIO_SetMode(P0, BIT6, GPIO_PMD_OUTPUT); //DB6
GPIO_SetMode(P0, BIT7, GPIO_PMD_OUTPUT); //DB7
GPIO_SetMode(P1, BIT0, GPIO_PMD_OUTPUT); //BIT0 左
GPIO_SetMode(P1, BIT1, GPIO_PMD_OUTPUT); //BIT1 右
GPIO_SetMode(P1, BIT2, GPIO_PMD_OUTPUT); //BIT2
GPIO_SetMode(P1, BIT3, GPIO_PMD_OUTPUT); //BIT3
GPIO_SetMode(P1, BIT4, GPIO_PMD_QUASI); //BIT0 左
GPIO_SetMode(P1, BIT5, GPIO_PMD_QUASI);
GPIO_SetMode(P1, BIT6, GPIO_PMD_QUASI); //BIT2
GPIO_SetMode(P1, BIT7, GPIO_PMD_QUASI); //BIT3
/* LED配置 */
GPIO_SetMode(P3, BIT6, GPIO_PMD_OUTPUT); //L_LED
GPIO_SetMode(P3, BIT7, GPIO_PMD_OUTPUT); //R_LED
GPIO_SetMode(P2, BIT0, GPIO_PMD_OUTPUT); //L_PWM
GPIO_SetMode(P2, BIT2, GPIO_PMD_OUTPUT); //R_PWM
GPIO_SetMode(P4, BIT4, GPIO_PMD_OUTPUT); //L_CTRL
GPIO_SetMode(P4, BIT5, GPIO_PMD_OUTPUT); //R_CTRL
/* 控制输出 */
// GPIO_SetMode(P4, BIT4, GPIO_PMD_OUTPUT); //P44
// GPIO_SetMode(P1, BIT5, GPIO_PMD_QUASI);
}
void WriteI2C(uint8_t c)
{
uint32_t i,j;
I2C_SCL = 1;
for(i=0;i<8000;i++);
for(j=0;j<=8;j++)
{
for(i=0;i<1000;i++);
I2C_SCL = 1;
for(i=0;i<1000;i++);
if((c&0x80)==0x80)
{
I2C_SDA = 1;
}
else
{
I2C_SDA = 0;
}
c = c<<1;
for(i=0;i<1000;i++);
I2C_SCL = 0;
}
I2C_SDA = 0;
}
void DelayMS(uint32_t p)
{
uint32_t i,j;
for(i=0;i<p;i++)
{
for(j=0;j<2000;j++);
}
}
void TransferCom(uint16_t data0);
void TransferData(uint16_t data1);
void display(void);
void display_grapic(void);
void delayms(uint16_t n);
void DisplayLine(uint16_t line1,uint16_t line2);
void DisplayGraphic(uint16_t *adder);
void delay(uint16_t m);
void lcd_mesg(uint16_t *adder1);
uint16_t IC_DAT[]={
0XB9,0XE3, 0XCA,0XA1, 0xC9,0xEE, 0XDB,0XDA, 0XCA,0XD0, 0XB8,0XA3, 0XCC,0XEF, 0XC7,0XF8, //显示第一行:广东深圳市福田区
0XD6,0XD0, 0XCE,0XC4, 0XD7,0XD6, 0XBF,0XE2, 0XD2,0XBA, 0XBE,0XA7, 0XC4,0XA3, 0XBF,0XE9, //显示第三行:中文字库液晶模块
0x31,0x32, 0x38,0x36, 0x34,0x2D, 0XB4,0XF8, 0XD6,0XD0, 0XCE,0XC4, 0XD7,0XD6, 0XBF,0XE2, //显示第二行:12864-带中文字库
0X53,0X54, 0X37,0X39, 0X32,0X30, 0XBC,0XF2, 0XCC,0XE5, 0XBA,0XBA, 0XD7,0XD6, 0XBF,0XE2, //显示第四行:ST7920简体汉字库
};
void initinal(void) //LCD字库初始化程序
{
delay(40); //大于40MS的延时程序
LCD_PSB=0; //设置为8BIT并口工作模式
delay(1); //延时
LCD_RST=0; //复位
delay(1); //延时
LCD_RST=1; //复位置高
delay(10);
TransferCom(0x30); //Extended Function Set :8BIT设置,RE=0: basic instruction set, G=0 :graphic display OFF
delay(100); //大于100uS的延时程序
TransferCom(0x0C); //Display Control,D=1,显示开
delay(100); //大于100uS的延时程序
TransferCom(0x01); //Display Clear
delay(10); //大于10mS的延时程序
TransferCom(0x06); //Enry Mode Set,光标从右向左加1位移动
delay(100); //大于100uS的延时程序
}
void initina2(void) //LCD显示图片(扩展)初始化程序
{
delay(40); //大于40MS的延时程序
LCD_PSB=0; //设置为8BIT并口工作模式
delay(1); //延时
LCD_RST=0; //复位
delay(1); //延时
LCD_RST=1; //复位置高
delay(10);
TransferCom(0x36); //Extended Function Set RE=1: extended instruction
delay(100); //大于100uS的延时程序
TransferCom(0x36); //Extended Function Set:RE=1: extended instruction set
delay(37); ////大于37uS的延时程序
TransferCom(0x3E); //EXFUNCTION(DL=8BITS,RE=1,G=1)
delay(100); //大于100uS的延时程序
TransferCom(0x01); //CLEAR SCREEN
delay(100); //大于100uS的延时程序
}
int main()
{
while(1)
{
initina2(); //调用LCD显示图片(扩展)初始化程序
DisplayGraphic(pic1); //显示图片1
delayms(200);
DisplayGraphic(pic2); //显示图片2
delayms(200);
DisplayGraphic(pic3); //显示图片3
delayms(200);
initinal(); //调用LCD字库初始化程序
delay(100); //大于100uS的延时程序
lcd_mesg(IC_DAT); //显示中文汉字1
delayms(100);
lcd_mesg(IC_DAT2); //显示中文汉字2
delayms(100);
}
}
void lcd_mesg(uint16_t *adder1)
{
unsigned char i;
TransferCom(0x80); //Set Graphic Display RAM AddLCD_RSTs
delay(100);
for(i=0;i<32;i++)
{
TransferData(*adder1);
adder1++;
}
TransferCom(0x90); //Set Graphic Display RAM AddLCD_RSTs
delay(100);
for(i=16;i<64;i++)
{
TransferData(*adder1);
adder1++;
}
}
void SendByte(uint16_t Dbyte)
{
uint8_t i;
for(i=0;i<8;i++)
{
if(Dbyte&0x80)
LCD_SID =1;
else
LCD_SID =0;
LCD_CLK =1;
LCD_CLK =0;
Dbyte =Dbyte<<1;
}
}
void TransferCom(uint16_t data0)
{
LCD_CS=1;
SendByte(0xf8); //11111,RW(0),RS(1),0
SendByte(0xf0&data0); //高四位
SendByte(0xf0&data0<<4); //低四位(先执行<<)
LCD_CS=0;
}
void TransferData(uint16_t data1)
{
LCD_CS=1;
SendByte(0xfa); //11111,RW(0),RS(1),0
SendByte(0xf0&data1); //高四位
SendByte(0xf0&data1<<4); //低四位(先执行<<)
LCD_CS=0;
}
void delayms(uint16_t n) //延时10×n毫秒程序
{
uint16_t i,j;
for(i=0;i<n;i++)
for(j=0;j<2000;j++);
}
void delay(uint16_t m) //延时程序
{
uint16_t i,j;
for(i=0;i<m;i++)
for(j=0;j<10;j++);
}
void DisplayGraphic(uint16_t *adder)
{
int i,j;
//*******显示上半屏内容设置
for(i=0;i<32;i++) //
{
TransferCom((0x80 + i)); //SET 垂直地址 VERTICAL ADD
TransferCom(0x80); //SET 水平地址 HORIZONTAL ADD
for(j=0;j<16;j++)
{
TransferData(*adder);
adder++;
}
}
//*******显示下半屏内容设置
for(i=0;i<32;i++) //
{
TransferCom((0x80 + i)); //SET 垂直地址 VERTICAL ADD
TransferCom(0x88); //SET 水平地址 HORIZONTAL ADD
for(j=0;j<16;j++)
{
TransferData(*adder);
adder++;
}
}
}
/*** (C) COPYRIGHT 2014 Nuvoton Technology Corp. ***/
|
|