本帖最后由 ljp98 于 2012-3-17 19:45 编辑
程序功能:
上电后,液晶上显示: " 菜农学习园地 "
" 欢迎你 -> NUC120 "
下面贴出主程序相关部份,完整工程在附件中,废话少说,直接上图。
//*****************************************************************************************
#include <stdio.h>
#include "NUC1xx.h"
#include "DrvGPIO.h"
#include "DrvSYS.h"
#include "DrvTimer.h"
#include "LCD12232.H"
//***************************************************************************************
// 表格
//***************************************************************************************
uint8_t tabhz00[]={ // "菜"
0x02,0x02,0x32,0x52,0x92,0x1F,0x32,0x52,0x12,0x1F,0x92,0x52,0x32,0x02,0x02,0x00,
0x00,0x42,0x42,0x22,0x12,0x0A,0x06,0xFF,0x06,0x0A,0x12,0x32,0x62,0x22,0x02,0x00};
uint8_t tabhz01[]={ // "农"
0x00,0x20,0x18,0x08,0x88,0xE8,0x1F,0x6A,0x88,0x08,0x88,0xC8,0xA8,0x1C,0x08,0x00,
0x08,0x04,0x02,0x41,0xFF,0x40,0x20,0x10,0x01,0x02,0x0D,0x18,0x70,0x20,0x20,0x00};
uint8_t tabhz02[]={ // "助"
0x00,0x00,0xFE,0x22,0x22,0x22,0xFE,0x00,0x10,0x10,0xFF,0x10,0x10,0xF0,0x00,0x00,
0x10,0x10,0x1F,0x11,0x11,0x09,0x4F,0x28,0x10,0x0C,0x03,0x20,0x40,0x3F,0x00,0x00};
uint8_t tabhz03[]={ // "学"
0x40,0x30,0x10,0x12,0x5C,0x54,0x50,0x51,0x5E,0xD4,0x50,0x18,0x57,0x32,0x10,0x00,
0x00,0x02,0x02,0x02,0x02,0x02,0x42,0x82,0x7F,0x02,0x02,0x02,0x02,0x02,0x02,0x00};
uint8_t tabhz04[]={ // "园"
0x00,0xFE,0x02,0x42,0x4A,0xCA,0x4A,0x4A,0xCA,0x4A,0x6A,0x42,0x02,0xFE,0x00,0x00,
0x00,0xFF,0x50,0x48,0x44,0x43,0x40,0x40,0x47,0x48,0x48,0x4E,0x40,0xFF,0x00,0x00};
uint8_t tabhz05[]={ // "地"
0x10,0x10,0x10,0xFE,0x10,0x50,0x40,0xFE,0x20,0x20,0xFF,0x10,0x10,0xF8,0x10,0x00,
0x20,0x20,0x10,0x1F,0x08,0x08,0x00,0x3F,0x40,0x40,0x4F,0x42,0x44,0x43,0x70,0x00};
uint8_t tabhz06[]={ // "欢"
0x14,0x24,0x44,0x84,0x64,0x1C,0x20,0x18,0x0F,0xE8,0x08,0x08,0x28,0x18,0x08,0x00,
0x20,0x10,0x4C,0x43,0x43,0x2C,0x20,0x10,0x0C,0x03,0x06,0x18,0x30,0x60,0x20,0x00};
uint8_t tabhz07[]={ // "迎"
0x40,0x41,0xCE,0x04,0x00,0xFC,0x04,0x02,0x02,0xFC,0x04,0x04,0x04,0xFC,0x00,0x00,
0x40,0x20,0x1F,0x20,0x40,0x47,0x42,0x41,0x40,0x5F,0x40,0x42,0x44,0x43,0x40,0x00};
uint8_t tabhz08[]={ // "你"
0x80,0x40,0xF0,0x2C,0x43,0x20,0x98,0x0F,0x0A,0xE8,0x08,0x88,0x28,0x1C,0x08,0x00,
0x00,0x00,0x7F,0x00,0x10,0x0C,0x03,0x21,0x40,0x3F,0x00,0x00,0x03,0x1C,0x08,0x00};
uint8_t tabzm00[]={ // "N"
0x08,0xF8,0x30,0xC0,0x00,0x08,0xF8,0x08,0x20,0x3F,0x20,0x00,0x07,0x18,0x3F,0x00};
uint8_t tabzm01[]={ // "U"
0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00};
uint8_t tabzm02[]={ // "C"
0xC0,0x30,0x08,0x08,0x08,0x08,0x38,0x00,0x07,0x18,0x20,0x20,0x20,0x10,0x08,0x00};
uint8_t tabfh00[]={ // "-"
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01};
uint8_t tabfh01[]={ // ">"
0x00,0x08,0x10,0x20,0x40,0x80,0x00,0x00,0x01,0x21,0x11,0x09,0x05,0x02,0x01,0x00};
uint8_t tabsz00[]={ // "0"
0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00};
uint8_t tabsz01[]={ // "1"
0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00};
uint8_t tabsz02[]={ // "2"
0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00};
//**************************************************************************************
// 主函数
//**************************************************************************************
int main(void)
{
UNLOCKREG(x); //解锁
DrvSYS_SetOscCtrl(E_SYS_XTL12M, 1); //设定时钟为外部12M
DrvSYS_Delay(5000); //延时以让系统稳定
LOCKREG(x); //上锁
init_1520();
wr_lcd_L(0,13,2,16,1,1,tabhz00); //“菜”
wr_lcd_L(0,29,2,16,1,1,tabhz01); //“农”
wr_lcd_L(0,45,2,16,1,1,tabhz02); //“助”
wr_lcd_R(0,0,2,16,1,1,tabhz03); //“学”
wr_lcd_R(0,16,2,16,1,1,tabhz04); //“园”
wr_lcd_R(0,32,2,16,1,1,tabhz05); //“地”
//-------------------------------------------------------------------------------------
wr_lcd_L(2,0,2,16,1,1,tabhz06); //"欢"
wr_lcd_L(2,16,2,16,1,1,tabhz07); //"迎"
wr_lcd_L(2,32,2,16,1,1,tabhz08); //"你"
wr_lcd_L(2,53,2,8,1,1,tabfh00); //"-"
wr_lcd_R(2,0,2,8,1,1,tabfh01); //">"
wr_lcd_R(2,13,2,8,1,1,tabzm00 ); //"N"
wr_lcd_R(2,21,2,8,1,1,tabzm01); //"U"
wr_lcd_R(2,29,2,8,1,1,tabzm02); //"C"
wr_lcd_R(2,37,2,8,1,1,tabsz01); //"1"
wr_lcd_R(2,45,2,8,1,1,tabsz02); //"2"
wr_lcd_R(2,53,2,8,1,1,tabsz00); //"0"
while(1);
}
//***********************************************************************************
[/code] |