打印

LCD(128*64)软件设计流程

[复制链接]
1948|1
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
njliu|  楼主 | 2007-1-26 19:39 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
沙发
NE5532| | 2007-1-27 11:58 | 只看该作者

跟你凑热闹,发一个C语言的,AVR单片机

ST7920串行接口

#include <iom8v.h>
#include <macros.h>

/***********************Port Define***********************/

#define    LCM_CLK_HIGH    PORTD|=0x02
#define    LCM_CLK_LOW    PORTD&=0xFD
#define    LCM_SID_HIGH    PORTD|=0x01
#define    LCM_SID_LOW    PORTD&=0xFE

#define    sync_command    0x00
#define sync_data    0x01

const char C_design[]=
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x3F,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0xFF,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x03,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x0F,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x1F,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x7F,0xE3,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0xFF,0x83,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x01,0xFF,0x03,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x03,0xFE,0x07,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x07,0xF8,0x07,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x0F,0xF0,0x0F,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x1F,0xE0,0x0F,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x3F,0xC0,0x1F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x7F,0x80,0x3F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0xFF,0x00,0x3F,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x01,0xFE,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x03,0xFC,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x07,0xFC,0x05,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x0F,0xF8,0x1F,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x0F,0xF0,0x3F,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x1F,0xE0,0x7F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x3F,0xC0,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x7F,0xC1,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x7F,0x81,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0xFF,0x03,0xFF,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x01,0xFF,0x07,0xFF,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x01,0xFE,0x07,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x03,0x80,0x00,0x00,
0x03,0xFE,0x0F,0xFE,0x00,0x03,0xFF,0xC7,0xFF,0xC7,0xFD,0xFE,0x1F,0xFB,0xE0,0xFE,
0x03,0xFC,0x0F,0xF8,0x00,0x03,0xFF,0xE7,0xFF,0xCF,0xFD,0xFE,0x3F,0xFB,0xF0,0xFE,
0x07,0xFC,0x0F,0xF0,0x00,0x00,0xF1,0xF1,0xE0,0xCE,0x1C,0x78,0x78,0x38,0xF8,0x38,
0x07,0xF8,0x0F,0xE0,0x00,0x00,0xF0,0xF9,0xE0,0xCE,0x1C,0x78,0xF0,0x38,0xFC,0x38,
0x0F,0xF8,0x07,0x80,0x01,0x80,0xF0,0x79,0xE1,0x8F,0x0C,0x78,0xF0,0x18,0xFE,0x38,
0x0F,0xF8,0x00,0x00,0x03,0x80,0xF0,0x79,0xE3,0x8F,0xCC,0x79,0xE0,0x00,0xFE,0x38,
0x0F,0xF0,0x00,0x00,0x07,0x80,0xF0,0x79,0xFF,0x87,0xF0,0x79,0xE0,0xFE,0xEF,0x38,
0x0F,0xF0,0x00,0x00,0x0F,0x00,0xF0,0x7D,0xFF,0x83,0xF8,0x79,0xE0,0xFE,0xEF,0xB8,
0x1F,0xF0,0x00,0x00,0x1E,0x00,0xF0,0x79,0xE3,0x81,0xFC,0x79,0xE0,0x78,0xE7,0xF8,
0x1F,0xF0,0x00,0x00,0x7C,0x00,0xF0,0x79,0xE1,0x8C,0x7E,0x79,0xE0,0x78,0xE3,0xF8,
0x1F,0xF0,0x00,0x00,0xF8,0x00,0xF0,0x79,0xE0,0x6C,0x3E,0x79,0xF0,0x78,0xE1,0xF8,
0x1F,0xF0,0x00,0x01,0xF0,0x00,0xF0,0xF9,0xE0,0x6E,0x1E,0x78,0xF0,0x78,0xE0,0xF8,
0x1F,0xF0,0x00,0x03,0xE0,0x00,0xF1,0xF1,0xE0,0xEE,0x1E,0x78,0x78,0x78,0xE0,0xF8,
0x1F,0xF0,0x00,0x0F,0xC0,0x03,0xFF,0xE7,0xFF,0xCF,0xFD,0xFE,0x7F,0xFB,0xF8,0x78,
0x1F,0xF0,0x00,0x1F,0x80,0x03,0xFF,0x87,0xFF,0xCF,0xF9,0xFE,0x1F,0xF3,0xF8,0x38,
0x1F,0xF8,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x03,0x80,0x00,0x00,
0x1F,0xFC,0x03,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x0F,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x0F,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x07,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x07,0xFF,0xFF,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x03,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x01,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x7F,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};

const char Doraemon[]=
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFE,0x90,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xF4,0x95,0xD8,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x36,0x56,0x96,0xDE,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0xCD,0xB9,0x7F,0x6B,0x80,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x03,0x76,0xD7,0x51,0xAA,0xE0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x07,0x9E,0x1D,0x70,0x6E,0x70,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x29,0x68,0x07,0xC0,0x33,0x30,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x5D,0x90,0x02,0x80,0x1D,0xAC,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x75,0x70,0x03,0x80,0x0A,0x56,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0xD6,0xA0,0x00,0x80,0x0F,0x5B,0x80,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0xEA,0xE0,0x01,0x00,0x05,0x4D,0x80,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x01,0x35,0x20,0x01,0x80,0x0B,0xB6,0x80,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x03,0xAA,0xE0,0x01,0x20,0x0C,0xA9,0xC0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x01,0xAA,0x60,0x0D,0xB0,0x0E,0xAC,0xE0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x06,0xEB,0x70,0x1D,0xF0,0x0E,0xD6,0x30,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x0E,0x2D,0xF0,0x0B,0x24,0x13,0xAA,0xF0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x05,0xD3,0x98,0x03,0xC0,0x10,0xF5,0x9C,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x0C,0xBC,0x0D,0x0D,0xF0,0x70,0x1E,0x6C,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x1E,0x98,0x06,0x1E,0x7B,0x40,0x0B,0x28,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x09,0x70,0x01,0xFB,0x9F,0x83,0xC5,0xDC,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x15,0x67,0xC0,0x1A,0x78,0x0E,0x03,0x24,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x15,0x60,0x7C,0x1B,0x90,0x70,0x03,0xFC,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x15,0xC0,0x06,0x0D,0x70,0x80,0x01,0x1C,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x1A,0x80,0x00,0x07,0xE0,0x08,0xB1,0xCC,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x15,0x80,0x00,0x01,0x40,0xBF,0xC0,0x74,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x15,0x9F,0xFF,0x00,0x80,0xE0,0x00,0x94,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x1A,0x80,0x00,0x00,0x80,0x00,0x00,0xDC,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x3B,0x00,0x00,0x00,0x80,0x80,0x00,0xD4,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x15,0x00,0x0F,0x00,0x81,0x7D,0x80,0xAC,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x15,0x03,0x78,0x00,0xA0,0x06,0xF8,0xAC,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x1D,0x0B,0xC0,0x00,0x80,0x10,0xE0,0xD4,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x15,0x0C,0x38,0x00,0x80,0x07,0x80,0xB8,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x0B,0x00,0x07,0x90,0x80,0xB8,0x00,0xC8,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x0D,0x80,0x01,0xC0,0x81,0xC0,0x01,0x78,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x78,0x8E,0x00,0x01,0xB8,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x0D,0x80,0x00,0x3E,0xFA,0x00,0x01,0x50,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x07,0x80,0x00,0x17,0xDF,0x80,0x13,0xB0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x05,0xC4,0x00,0x2A,0xEB,0x00,0x02,0xD0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x02,0xC0,0x00,0x36,0xDB,0x00,0x02,0xC0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x03,0xC0,0x00,0x3A,0xD5,0x00,0x07,0x48,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x01,0x60,0x00,0x1A,0xDB,0x00,0x05,0x80,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x01,0xA4,0x00,0x1B,0x6F,0x00,0x0D,0x90,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0xF0,0x40,0x0D,0xAA,0x00,0x1D,0x80,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x01,0xD0,0x00,0x0F,0x5C,0x00,0x16,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x7A,0x00,0x01,0xF0,0x00,0x1B,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x42,0x36,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x01,0x3C,0x48,0x07,0xF0,0x00,0xD8,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xFE,0x3F,0xFF,0x72,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x4B,0x57,0x7C,0x8B,0x5A,0xFA,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x5D,0xE9,0x97,0xFD,0xEF,0x1A,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x4D,0x6D,0xD8,0x9A,0x2B,0xF8,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x2F,0xBF,0xFC,0x8F,0xFD,0xE8,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x06,0xB9,0x42,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x05,0x2A,0x53,0xE8,0x48,0x80,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x08,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};

const char mop[]=
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x7D,0xFF,0x80,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xB7,0xBB,0xC0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0D,0xD0,0x01,0xC0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x38,0x70,0xB0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0D,0xEF,0xFE,0xE0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0D,0xFF,0x5E,0xD0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x29,0x61,0xC0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x38,0x74,0x10,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x01,0xEF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0xBE,0xB6,0x80,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x80,0x30,0x50,0x40,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x8F,0xDF,0xFF,0x80,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x87,0xFF,0xFF,0xC0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x07,0xC1,0x8D,0xDD,0xAB,0xE0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x18,0x00,0xF2,0x97,0x2E,0x20,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x0F,0x8D,0xE3,0x80,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x4F,0x87,0xF5,0x63,0xEF,0x80,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x03,0x78,0x39,0xC0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x01,0x5D,0x09,0xE0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x11,0x8F,0xE2,0xD0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x02,0x00,0xF0,0x44,0x83,0xB8,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x02,0x00,0x90,0x00,0x80,0x50,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x04,0x00,0x91,0x00,0x40,0x08,0x38,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x04,0x00,0xF0,0x44,0x40,0x01,0xFE,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x40,0x00,0xC3,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x40,0x00,0x03,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x10,0xC0,0x00,0x03,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x80,0x00,0x04,0x80,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x80,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x03,0x00,0x00,0x39,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x16,0x00,0x00,0x44,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x34,0xA4,0x98,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x03,0xFF,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x07,0xFF,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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};

const char mop_874[]=
{
0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x10,0x02,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x20,0x09,0x23,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x05,0x00,0x10,0x80,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x01,0x28,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x28,0x50,0x80,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x02,0x08,0x09,0x00,0x0A,0x40,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x02,0x25,0x20,0x00,0x89,0x20,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x02,0x25,0x58,0x94,0x44,0x90,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x01,0x65,0x0C,0x82,0x54,0x90,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x04,0xB9,0x89,0x09,0x26,0x48,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x03,0xB5,0x54,0x61,0x51,0xA0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x02,0xAD,0x56,0xB0,0x2C,0xB8,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x02,0xFF,0x66,0xAA,0x24,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x03,0xD3,0x45,0x3C,0xD4,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x01,0x61,0x16,0xAB,0x28,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0xDC,0x10,0x2E,0x28,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x9F,0x9B,0x28,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0xD4,0x00,0x65,0x20,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x68,0x06,0x1D,0xD0,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x01,0x5C,0x39,0x0C,0xA4,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x01,0x52,0x3E,0x2B,0xF0,0x80,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x03,0x60,0x01,0x35,0x0C,0x40,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x02,0xD3,0xC4,0x4D,0xB2,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x05,0x7F,0x60,0x7D,0x2A,0x80,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x04,0xB5,0xAB,0xC5,0x12,0x40,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x0B,0x6E,0xDE,0x63,0x0D,0x30,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x17,0xBB,0x22,0x99,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x12,0xD6,0x92,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x17,0xE0,0x31,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x70,0x29,0xA6,0x89,0x55,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x58,0x6E,0xFA,0x6D,0x0A,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0xC8,0x2B,0x4D,0xC1,0xA8,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x70,0x57,0xB5,0x6D,0x1D,0x7F,0xC0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0xAA,0xBD,0x12,0x08,0x3F,0xE0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0xD7,0x56,0x46,0x0E,0x87,0xE0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x5C,0xFA,0x24,0x57,0x51,0xF0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x01,0x57,0xAA,0x09,0x26,0x00,0xF0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x02,0x72,0xF4,0x90,0x6C,0x28,0xF0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x02,0x17,0xD1,0x44,0xCD,0xC2,0x70,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x55,0x78,0x71,0x30,0x71,0x70,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x09,0x5F,0xAE,0x13,0xE4,0x54,0xFC,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x17,0x4A,0xFF,0xCA,0x42,0x30,0xF3,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x69,0x26,0x5A,0x1C,0xD4,0x82,0xEC,0xAB,0x50,0x00,0x00,0x00,
0x00,0x00,0x00,0x03,0x6D,0x0C,0x2F,0x0C,0x41,0x51,0xE2,0xA9,0x48,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0x52,0x08,0x1D,0x0C,0x14,0x01,0xE1,0x24,0x08,0x00,0x00,0x00,
0x00,0x00,0x00,0x05,0x5B,0x10,0x04,0xD5,0x88,0x57,0xE1,0xD5,0xB0,0x00,0x00,0x00,
0x00,0x00,0x00,0x02,0xA0,0x00,0x06,0x19,0xE1,0x03,0x60,0x5C,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x02,0xAE,0x00,0x01,0x5D,0xE4,0x94,0x20,0xC7,0xD8,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0x42,0x00,0x00,0x2B,0x78,0x43,0x90,0x70,0x50,0x00,0x00,0x00,
0x00,0x00,0x00,0x04,0xA8,0x00,0x20,0x35,0xB5,0x0B,0x30,0x1B,0xA0,0x00,0x00,0x00,
0x00,0x00,0x00,0x03,0x48,0x00,0xC9,0x0D,0x70,0x82,0x20,0x0E,0x40,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0x28,0x00,0x0E,0xA5,0xE8,0x61,0xE0,0x03,0x70,0x00,0x00,0x00,
0x00,0x00,0x00,0x02,0x28,0x01,0x16,0x86,0x84,0x1F,0xE0,0x00,0xA0,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0x90,0x01,0x5A,0x42,0x01,0x7A,0xB0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x84,0x83,0xA4,0xE6,0xBC,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0xA7,0x00,0xF7,0x47,0xD6,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x54,0x00,0x3F,0x2C,0xAA,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xFF,0x77,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0xF4,0xDD,0x80,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x0F,0x66,0x80,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0D,0xE5,0x3B,0x80,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1B,0x5D,0xD5,0xC0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0D,0x76,0xAA,0x40,0x00,0x00,0x00,0x00
};

void System_init (void)
{
    DDRB = 0xFF;
    DDRC = 0xFF;
    DDRD = 0xFF;

    PORTB = 0xFF;
    PORTC = 0xFF;
    PORTD = 0xFF;
}

void delay_ms (char ms_time)
{
    unsigned char m,n;
    while(ms_time>0)
    {
        for (n=1;n<4;n++)
        {
            for (m=1;m<255;m++)
                asm("nop");
        }
        ms_time--;
    }
}

void send_sync (unsigned char sync_type)
{
    unsigned char send_counter = 5;

    LCM_SID_HIGH;

    while(send_counter--)
    {
        LCM_CLK_HIGH;
        LCM_CLK_LOW;                //Sync Bit String, 5x"1" Bit
    }

    LCM_SID_LOW;                    // R/W = Write
    LCM_CLK_HIGH;
    LCM_CLK_LOW;

    if(sync_type)
    {
        LCM_SID_HIGH;                // R/S = Data
        LCM_CLK_HIGH;
        LCM_CLK_LOW;
    }
    else
    {
        LCM_CLK_HIGH;                // R/S = Command
        LCM_CLK_LOW;
    }

    LCM_SID_LOW;                    //Fixed "0" Bit
    LCM_CLK_HIGH;
    LCM_CLK_LOW;
}

void send_data (unsigned char data)
{
    unsigned char send_counter;
    unsigned char high_low = 2;

    while(high_low--)
    {
        send_counter = 4;

        while(send_counter--)            //Send High / Low Half Byte
        {
            if(data&0x80)
                LCM_SID_HIGH;        //Send A "1" Bit
            else
                LCM_SID_LOW;        //Send A "0" Bit

            LCM_CLK_HIGH;
            LCM_CLK_LOW;
            data = data<<1;
        }

        send_counter = 4;

        LCM_SID_LOW;

        while(send_counter--)            //Fixed 4x"0" Bit
        {
            LCM_CLK_HIGH;
            LCM_CLK_LOW;
        }
    }
}

void init_lcm (void)
{
    send_sync(sync_command);
    send_data(0x0C);
    delay_ms(1);
}

void turn_on_grafic (void)
{
    send_sync(sync_command);
    send_data(0x36);                //Enter Extended Instruction
    delay_ms(1);
}

void turn_off_grafic (void)
{
    send_sync(sync_command);
    send_data(0x34);                //Enter Extended Instruction
    delay_ms(1);
}

void set_GD_addr (unsigned char x, unsigned char y)
{
    send_sync(sync_command);
    send_data(y|0x80);
    send_data(x|0x80);
    delay_ms(1);
}

void CG_cls (void)                    //Clear Scream, CG Mode
{
    send_sync(sync_command);
    send_data(1);
    delay_ms(1);
}

void GD_cls(void)
{
    unsigned char x,y;

    turn_off_grafic();

    x = 0;
    y = 0;

    while(y<32)
    {
        set_GD_addr(x,y);
        send_sync(sync_data);

        while(x<32)
        {
            send_data(0xAA);
            x++;
        }

        x = 0;
        y++;
    }

    delay_ms(1);
    turn_on_grafic();
}

void lcm_printf (void)
{
    char string[] = "The Brown Fox Jumps Over";
    char* sp = &string[0];

    send_sync(sync_data);

    while(*sp != 0)
    {
        send_data(*sp);
        sp++;
    }
}

void DG_draw (const char* picture)
{
    unsigned char x,y;
    const char* DG_p;

    DG_p = picture;

    turn_off_grafic();

    x = 0;
    y = 0;

    while(y<32)
    {
        set_GD_addr(x,y);

        send_sync(sync_data);

        while(x<16)
        {
            send_data(*DG_p);
            DG_p++;
            x++;
        }

        x = 0;
        y++;
    }
    
    x = 8;
    y = 0;

    while(y<32)
    {
        set_GD_addr(x,y);

        send_sync(sync_data);

        while(x<24)
        {
            send_data(*DG_p);
            DG_p++;
            x++;
        }

        x = 8;
        y++;
    }

    delay_ms(1);
    turn_on_grafic();
}

void main (void)
{
    unsigned char m,n,x,y;

    System_init();
    init_lcm();
    CG_cls();
//    lcm_printf();
    GD_cls();

    while(1)
    {
        DG_draw(&Doraemon[0]);
        delay_ms(255);
        delay_ms(255);
        delay_ms(255);
        DG_draw(&C_design[0]);
        delay_ms(255);
        delay_ms(255);
        delay_ms(255);
        DG_draw(&mop[0]);
        delay_ms(255);
        delay_ms(255);
        delay_ms(255);
        DG_draw(&mop_874[0]);
        delay_ms(255);
        delay_ms(255);
        delay_ms(255);
    }
}

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

11

主题

29

帖子

1

粉丝