期末大作业-增加矩阵LED
This commit is contained in:
parent
618ae827f1
commit
de909caa14
2316
FinalHomework/Core/Inc/8X16.h
Normal file
2316
FinalHomework/Core/Inc/8X16.h
Normal file
File diff suppressed because it is too large
Load Diff
189
FinalHomework/Core/Inc/GB1616.h
Normal file
189
FinalHomework/Core/Inc/GB1616.h
Normal file
@ -0,0 +1,189 @@
|
|||||||
|
// ------------------ 汉字字模的数据结构定义 ------------------------ //
|
||||||
|
//struct typFNT_GB16 // 汉字字模数据结构
|
||||||
|
//{
|
||||||
|
// unsigned char Index[3]; // 汉字内码索引
|
||||||
|
// unsigned char Msk[32]; // 点阵码数据
|
||||||
|
//};
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
unsigned char Index[2];
|
||||||
|
char Msk[32];
|
||||||
|
}typFNT_GB16;
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////
|
||||||
|
// 汉字字模表 //
|
||||||
|
// 汉字库: 宋体16.dot,横向取模左高位,数据排列:从左到右从上到下 //
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
const typFNT_GB16 code codeGB_16[64] = // 数据表
|
||||||
|
{
|
||||||
|
"上",0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x03,0xF8,0x02,0x00,
|
||||||
|
0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0xFF,0xFE,0x00,0x00,
|
||||||
|
|
||||||
|
"海",0x02,0x00,0x42,0x08,0x33,0xFC,0x14,0x00,0x8B,0xF8,0x62,0x88,0x22,0x48,0x0A,0x08,
|
||||||
|
0x1F,0xFE,0x24,0x88,0xE4,0x48,0x24,0x08,0x27,0xFC,0x20,0x08,0x20,0x28,0x20,0x10,
|
||||||
|
|
||||||
|
/*-- 文字: 电 --*/
|
||||||
|
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
|
||||||
|
"电",0x01,0x00,0x01,0x00,0x01,0x00,0x3F,0xF8,0x21,0x08,0x21,0x08,0x3F,0xF8,0x21,0x08,
|
||||||
|
0x21,0x08,0x21,0x08,0x3F,0xF8,0x21,0x08,0x01,0x02,0x01,0x02,0x00,0xFE,0x00,0x00,
|
||||||
|
|
||||||
|
/*-- 文字: 子 --*/
|
||||||
|
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
|
||||||
|
"子",0x00,0x00,0x3F,0xF0,0x00,0x20,0x00,0x40,0x00,0x80,0x01,0x00,0x01,0x00,0x01,0x04,
|
||||||
|
0xFF,0xFE,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x05,0x00,0x02,0x00,
|
||||||
|
|
||||||
|
/*-- 文字: 科 --*/
|
||||||
|
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
|
||||||
|
"科",0x06,0x08,0x78,0x88,0x08,0x48,0x08,0x48,0xFE,0x08,0x18,0x88,0x1C,0x48,0x2A,0x48,
|
||||||
|
0x28,0x0E,0x48,0x78,0x8B,0x88,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,
|
||||||
|
|
||||||
|
/*-- 文字: 技 --*/
|
||||||
|
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
|
||||||
|
"技",0x10,0x20,0x10,0x20,0x10,0x20,0xFD,0xFE,0x10,0x20,0x14,0x20,0x19,0xFC,0x31,0x08,
|
||||||
|
0xD0,0x88,0x10,0x90,0x10,0x60,0x10,0x60,0x10,0x90,0x11,0x0E,0x56,0x04,0x20,0x00,
|
||||||
|
|
||||||
|
/*-- 文字: 有 --*/
|
||||||
|
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
|
||||||
|
"有",0x01,0x00,0x01,0x00,0x7F,0xFE,0x02,0x00,0x04,0x00,0x0F,0xF0,0x18,0x10,0x28,0x10,
|
||||||
|
0x4F,0xF0,0x88,0x10,0x08,0x10,0x0F,0xF0,0x08,0x10,0x08,0x90,0x08,0x70,0x08,0x20,
|
||||||
|
|
||||||
|
/*-- 文字: 限 --*/
|
||||||
|
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
|
||||||
|
"限",0x00,0x00,0xFB,0xF8,0x92,0x08,0x93,0xF8,0xA2,0x08,0xA2,0x08,0x93,0xF8,0x8A,0x80,
|
||||||
|
0x8A,0x48,0xAA,0x50,0x92,0x20,0x82,0x20,0x82,0x10,0x82,0x8E,0x83,0x04,0x82,0x00,
|
||||||
|
|
||||||
|
/*-- 文字: 公 --*/
|
||||||
|
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
|
||||||
|
"公",0x00,0x00,0x04,0x40,0x06,0x40,0x04,0x40,0x08,0x20,0x08,0x10,0x10,0x18,0x22,0x0E,
|
||||||
|
0x43,0x04,0x02,0x00,0x04,0x20,0x08,0x10,0x11,0xF8,0x3F,0x18,0x10,0x10,0x00,0x00,
|
||||||
|
|
||||||
|
/*-- 文字: 司 --*/
|
||||||
|
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
|
||||||
|
"司",0x00,0x00,0x3F,0xFC,0x00,0x04,0x00,0x04,0x7F,0xE4,0x00,0x04,0x00,0x04,0x3F,0xC4,
|
||||||
|
0x20,0x44,0x20,0x44,0x3F,0xC4,0x20,0x44,0x20,0x04,0x00,0x14,0x00,0x08,0x00,0x00,
|
||||||
|
|
||||||
|
/*-- 文字: 术 --*/
|
||||||
|
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
|
||||||
|
"术",0x01,0x00,0x01,0x20,0x01,0x10,0x01,0x00,0xFF,0xFE,0x01,0x00,0x03,0x80,0x05,0x40,
|
||||||
|
0x05,0x20,0x09,0x10,0x11,0x18,0x21,0x0E,0xC1,0x04,0x01,0x00,0x01,0x00,0x00,0x00,
|
||||||
|
|
||||||
|
"网",0x00,0x00,0x7F,0xFC,0x40,0x04,0x40,0x04,0x42,0x14,0x52,0x94,0x4A,0x54,0x44,
|
||||||
|
0x24,0x44,0x24,0x4A,0x54,0x4A,0x54,0x52,0x94,0x61,0x04,0x40,0x04,0x40,0x14,0x40,0x08,/*"网,0*/
|
||||||
|
|
||||||
|
"络",0x10,0x80,0x10,0x80,0x20,0xF8,0x21,0x08,0x4B,0x10,0xFC,0xA0,0x10,0x40,0x20,0xA0,
|
||||||
|
0x41,0x18,0xFA,0x06,0x45,0xF8,0x01,0x08,0x19,0x08,0xE1,0x08,0x41,0xF8,0x01,0x08,/*"络,1*/
|
||||||
|
|
||||||
|
"演",0x00,0x80,0x20,0x40,0x17,0xFC,0x14,0x04,0x80,0x00,0x43,0xF8,0x40,0x40,0x13,0xF8,
|
||||||
|
0x12,0x48,0x23,0xF8,0xE2,0x48,0x23,0xF8,0x20,0x00,0x21,0x10,0x22,0x08,0x04,0x04,/*"演,2*/
|
||||||
|
|
||||||
|
"示",0x00,0x00,0x3F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFE,0x01,
|
||||||
|
0x00,0x01,0x00,0x11,0x10,0x11,0x08,0x21,0x04,0x41,0x02,0x81,0x02,0x05,0x00,0x02,0x00,/*"示,3*/
|
||||||
|
|
||||||
|
"节",0x08,0x20,0x08,0x20,0xFF,0xFE,0x08,0x20,0x08,0x20,0x00,0x00,0x7F,0xF8,0x02,0x08,
|
||||||
|
0x02,0x08,0x02,0x08,0x02,0x08,0x02,0x50,0x02,0x20,0x02,0x00,0x02,0x00,0x02,0x00,/*"节,4*/
|
||||||
|
|
||||||
|
"点",0x02,0x00,0x02,0x00,0x02,0x00,0x03,0xFC,0x02,0x00,0x02,0x00,0x3F,0xF0,0x20,0x10,
|
||||||
|
0x20,0x10,0x20,0x10,0x3F,0xF0,0x00,0x00,0x24,0x88,0x22,0x44,0x42,0x44,0x80,0x04,/*"点,5*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
"顺",0x00,0x00,0x00,0xD6,0x54,0x54,0x54,0x54,
|
||||||
|
0x54,0x6C,0x28,0x28,0x28,0x28,0x00,0x00,/*"W",0*/
|
||||||
|
0x00,0x00,0x00,0x7C,0x10,0x10,0x10,0x10,
|
||||||
|
0x10,0x10,0x10,0x10,0x10,0x7C,0x00,0x00,/*"I",1*/
|
||||||
|
|
||||||
|
"序",0x00,0x00,0x00,0xFC,0x42,0x48,0x48,0x78,
|
||||||
|
0x48,0x48,0x40,0x40,0x40,0xE0,0x00,0x00,/*"F",2*/
|
||||||
|
0x00,0x00,0x00,0x7C,0x10,0x10,0x10,0x10,
|
||||||
|
0x10,0x10,0x10,0x10,0x10,0x7C,0x00,0x00,/*"I",3*/
|
||||||
|
|
||||||
|
"无",0x00,0x00,0x3F,0xF0,0x02,0x00,0x02,0x00,
|
||||||
|
0x02,0x00,0x02,0x00,0x7F,0xFC,0x04,0x80,
|
||||||
|
0x04,0x80,0x04,0x80,0x08,0x80,0x08,0x80,
|
||||||
|
0x10,0x84,0x20,0x84,0x40,0x7C,0x80,0x00,/*"无",4*/
|
||||||
|
|
||||||
|
"线",0x10,0x50,0x10,0x48,0x20,0x40,0x24,0x5C,
|
||||||
|
0x45,0xE0,0xF8,0x40,0x10,0x5E,0x23,0xE0,
|
||||||
|
0x40,0x44,0xFC,0x48,0x40,0x30,0x00,0x22,
|
||||||
|
0x1C,0x52,0xE0,0x8A,0x43,0x06,0x00,0x02,/*"线",5*/
|
||||||
|
|
||||||
|
|
||||||
|
"传",0x08,0x40,0x08,0x40,0x08,0x40,0x13,0xF8,0x10,0x40,0x30,0x80,0x37,0xFE,0x50,0x80,
|
||||||
|
0x91,0x00,0x13,0xF8,0x10,0x08,0x11,0x10,0x10,0xA0,0x10,0x40,0x10,0x20,0x10,0x20,
|
||||||
|
|
||||||
|
"感",0x00,0x28,0x00,0x24,0x3F,0xFE,0x20,0x20,0x2F,0xA4,0x20,0x24,0x2F,0xA8,0x28,0x98,
|
||||||
|
0x28,0x92,0x4F,0xAA,0x40,0x46,0x80,0x82,0x01,0x00,0x48,0x84,0x48,0x12,0x87,0xF2,
|
||||||
|
|
||||||
|
"器",0x00,0x00,0x3E,0x7C,0x22,0x44,0x22,0x44,0x3E,0x7C,0x01,0x20,0x01,0x10,0xFF,0xFE,
|
||||||
|
0x02,0x80,0x0C,0x60,0x30,0x18,0xC0,0x06,0x3E,0x7C,0x22,0x44,0x22,0x44,0x3E,0x7C,
|
||||||
|
|
||||||
|
"光",0x01,0x00,0x21,0x08,0x11,0x08,0x09,0x10,0x09,0x20,0x01,0x00,0xFF,0xFE,0x04,0x40,
|
||||||
|
0x04,0x40,0x04,0x40,0x04,0x40,0x08,0x42,0x08,0x42,0x10,0x42,0x20,0x3E,0xC0,0x00,
|
||||||
|
|
||||||
|
"照",0x00,0x00,0x7D,0xFC,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x94,0x7D,0x08,0x44,0xFC,
|
||||||
|
0x44,0x84,0x44,0x84,0x44,0x84,0x7C,0xFC,0x00,0x00,0x48,0x88,0x44,0x44,0x84,0x44,/*"照",1*/
|
||||||
|
|
||||||
|
"请",0x00,0x40,0x40,0x40,0x27,0xFC,0x20,0x40,0x03,0xF8,0x00,0x40,0xE7,0xFE,0x20,0x00,
|
||||||
|
0x23,0xF8,0x22,0x08,0x23,0xF8,0x22,0x08,0x2B,0xF8,0x32,0x08,0x22,0x28,0x02,0x10,/*"请",0*/
|
||||||
|
|
||||||
|
"选",0x00,0x40,0x22,0x40,0x12,0x40,0x13,0xF8,0x04,0x40,0x00,0x40,0xF7,0xFC,0x11,0x20,
|
||||||
|
0x11,0x20,0x11,0x20,0x12,0x24,0x12,0x24,0x14,0x1C,0x28,0x00,0x47,0xFE,0x00,0x00,/*"选",1*/
|
||||||
|
|
||||||
|
"择",0x20,0x00,0x27,0xF8,0x22,0x08,0x21,0x10,0xF0,0xA0,0x20,0x40,0x21,0xB0,0x26,0x4E,
|
||||||
|
0x30,0x40,0xE3,0xF8,0x20,0x40,0x20,0x40,0x27,0xFC,0x20,0x40,0xA0,0x40,0x40,0x40,/*"择",2*/
|
||||||
|
|
||||||
|
"你",0x08,0x80,0x08,0x80,0x08,0x80,0x11,0xFE,0x11,0x02,0x32,0x04,0x34,0x20,0x50,0x20,
|
||||||
|
0x91,0x28,0x11,0x24,0x12,0x24,0x12,0x22,0x14,0x22,0x10,0x20,0x10,0xA0,0x10,0x40,/*"你",3*/
|
||||||
|
|
||||||
|
"的",0x10,0x40,0x10,0x40,0x20,0x40,0x7E,0x7C,0x42,0x84,0x42,0x84,0x43,0x04,0x42,0x44,
|
||||||
|
0x7E,0x24,0x42,0x24,0x42,0x04,0x42,0x04,0x42,0x04,0x7E,0x04,0x42,0x28,0x00,0x10,/*"的",4*/
|
||||||
|
|
||||||
|
"名",0x02,0x00,0x02,0x00,0x07,0xF0,0x08,0x10,0x14,0x20,0x62,0x40,0x02,0x80,0x01,0x00,
|
||||||
|
0x06,0x00,0x1F,0xF8,0xE8,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x0F,0xF8,0x08,0x08,/*"名",5*/
|
||||||
|
|
||||||
|
"称",0x08,0x80,0x1C,0x80,0xF0,0x80,0x10,0xFE,0x11,0x02,0xFD,0x04,0x12,0x20,0x30,0x20,
|
||||||
|
0x38,0xA8,0x54,0xA4,0x51,0x24,0x91,0x22,0x12,0x22,0x10,0x20,0x10,0xA0,0x10,0x40,/*"称",6*/
|
||||||
|
|
||||||
|
|
||||||
|
"编",0x10,0x80,0x10,0x40,0x23,0xFC,0x22,0x04,0x4A,0x04,0xFB,0xFC,0x12,0x00,0x22,0x00,
|
||||||
|
0x43,0xFC,0xFB,0x54,0x43,0x54,0x05,0xFC,0x1D,0x54,0xE5,0x54,0x49,0x44,0x01,0x0C,/*"编",0*/
|
||||||
|
|
||||||
|
|
||||||
|
"模",0x11,0x10,0x11,0x10,0x17,0xFC,0x11,0x10,0xFC,0x00,0x13,0xF8,0x32,0x08,0x3B,0xF8,0x56,
|
||||||
|
0x08,0x53,0xF8,0x90,0x40,0x17,0xFC,0x10,0xA0,0x11,0x10,0x12,0x08,0x14,0x06,/*"模",0*/
|
||||||
|
|
||||||
|
"式",0x00,0x48,0x00,0x44,0x00,0x44,0x00,0x40,0xFF,0xFE,0x00,0x40,0x00,0x40,0x3E,0x40,0x08,
|
||||||
|
0x40,0x08,0x40,0x08,0x20,0x08,0x22,0x0F,0x12,0x78,0x0A,0x20,0x06,0x00,0x02,/*"式",1*/
|
||||||
|
|
||||||
|
"下",0x00,0x00,0xFF,0xFE,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x40,0x02,0x20,0x02,
|
||||||
|
0x10,0x02,0x08,0x02,0x08,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,/*"下",1*/
|
||||||
|
|
||||||
|
"确",0x00,0x40,0x00,0x40,0xFC,0x7C,0x10,0x84,0x11,0x08,0x22,0xFE,0x3C,0x92,0x64,0x92,0x64,
|
||||||
|
0xFE,0xA4,0x92,0x24,0x92,0x24,0xFE,0x3C,0x92,0x25,0x12,0x21,0x0A,0x02,0x04,/*"确",2*/
|
||||||
|
|
||||||
|
"定",0x02,0x00,0x01,0x00,0x7F,0xFE,0x40,0x02,0x80,0x04,0x00,0x00,0x3F,0xF8,0x01,0x00,0x01,
|
||||||
|
0x00,0x11,0x00,0x11,0xF8,0x11,0x00,0x11,0x00,0x29,0x00,0x47,0xFE,0x80,0x00,/*"定",3*/
|
||||||
|
|
||||||
|
|
||||||
|
"类",0x01,0x00,0x11,0x10,0x09,0x20,0x01,0x00,0x7F,0xFC,0x05,0x40,0x09,0x20,0x11,0x10,0x60,
|
||||||
|
0x08,0x01,0x00,0xFF,0xFE,0x02,0x80,0x04,0x40,0x08,0x20,0x30,0x18,0xC0,0x06,/*"类",0*/
|
||||||
|
|
||||||
|
"型",0x00,0x04,0x7F,0x84,0x12,0x24,0x12,0x24,0x12,0x24,0xFF,0xA4,0x12,0x24,0x22,0x04,0x22,
|
||||||
|
0x14,0x41,0x08,0x81,0x00,0x3F,0xF8,0x01,0x00,0x01,0x00,0xFF,0xFE,0x00,0x00,/*"型",1*/
|
||||||
|
|
||||||
|
"方",0x01,0x80,0x03,0xC0,0x07,0xE0,0x0F,0xF0,0x1F,0xF8,0x3F,0xFC,0x7F,0xFE,0x00,0x00,0x00,
|
||||||
|
0x00,0x7F,0xFE,0x3F,0xFC,0x1F,0xF8,0x0F,0xF0,0x07,0xE0,0x03,0xC0,0x01,0x80,/*箭头符号*/
|
||||||
|
|
||||||
|
"标",0x07,0xE0,0x1F,0xF8,0x3F,0xFC,0x7C,0x3E,0xF0,0x0E,0xE7,0x8F,0xEF,0xA7,0xE1,0xF7,/*"公司LOGO"*/
|
||||||
|
0xEF,0xF7,0xE1,0xE7,0xEF,0x6F,0x70,0x0E,0x78,0x1E,0x3F,0xFC,0x1F,0xF8,0x07,0xE0,
|
||||||
|
|
||||||
|
"号",0x00,0x00,0x1F,0xF0,0x10,0x10,0x10,0x10,0x10,0x10,0x1F,0xF0,0x00,0x00,0xFF,0xFE,
|
||||||
|
0x08,0x00,0x10,0x00,0x1F,0xF0,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0xA0,0x00,0x40,/*"号",0*/
|
||||||
|
|
||||||
|
"號",0x00,0x00,0x07,0xE0,0x38,0x1C,0x60,0x06,0x43,0xC2,0x0E,0x70,0x30,0x0C,0x00,0x00,
|
||||||
|
0x07,0xE0,0x0C,0x30,0x00,0x00,0x01,0x80,0x02,0x40,0x03,0xC0,0x01,0x80,0x00,0x00,/*网络标示*/
|
||||||
|
};
|
||||||
|
|
111
FinalHomework/Core/Inc/GB3232.h
Normal file
111
FinalHomework/Core/Inc/GB3232.h
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
// ------------------ 汉字字模的数据结构定义 ------------------------ //
|
||||||
|
//struct typFNT_GB32 // 汉字字模数据结构
|
||||||
|
//{
|
||||||
|
// unsigned char Index[3]; // 汉字内码索引
|
||||||
|
// unsigned char Msk[128]; // 点阵码数据
|
||||||
|
//};
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
unsigned char Index[2];
|
||||||
|
char Msk[128];
|
||||||
|
}typFNT_GB32;
|
||||||
|
/////////////////////////////////////////////////////////////////////////
|
||||||
|
// 汉字字模表 //
|
||||||
|
// 汉字库: 宋体32.dot,横向取模左高位,数据排列:从左到右从上到下 //
|
||||||
|
// 取模走向:顺向 点阵格式:阴吗;取模方式:逐行式
|
||||||
|
/////////////////////////////////////////////////////////////////////////
|
||||||
|
const typFNT_GB32 code codeGB_32[] = // 数据表
|
||||||
|
{
|
||||||
|
|
||||||
|
"上",0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x03,0x80,0x00,0x00,
|
||||||
|
0x03,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
|
||||||
|
0x03,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
|
||||||
|
0x03,0x00,0xC0,0x00,0x03,0xFF,0xE0,0x00,0x03,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
|
||||||
|
0x03,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
|
||||||
|
0x03,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
|
||||||
|
0x03,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x03,0x00,0x18,0x3F,
|
||||||
|
0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"上",0*/
|
||||||
|
|
||||||
|
"海",0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x08,0x07,0x00,0x00,
|
||||||
|
0x04,0x06,0x00,0x00,0x06,0x04,0x00,0x20,0x03,0x0F,0xFF,0xF0,0x02,0x0C,0x00,0x00,
|
||||||
|
0x00,0x18,0x00,0x00,0x40,0x98,0x00,0x00,0x20,0xBF,0xFF,0xC0,0x30,0xAC,0x00,0xC0,
|
||||||
|
0x19,0x4C,0x40,0x80,0x19,0x0C,0x60,0x80,0x01,0x0C,0x30,0x80,0x01,0x08,0x30,0x80,
|
||||||
|
0x02,0x18,0x00,0x88,0x03,0xFF,0xFF,0xFC,0x02,0x18,0x81,0x80,0x04,0x18,0x41,0x80,
|
||||||
|
0x04,0x18,0x61,0x80,0x0C,0x10,0x21,0x80,0x3C,0x30,0x21,0x80,0x0C,0x30,0x01,0x88,
|
||||||
|
0x08,0x7F,0xFF,0xFC,0x08,0x20,0x01,0x80,0x18,0x00,0x01,0x80,0x18,0x00,0x41,0x00,
|
||||||
|
0x1C,0x00,0x3F,0x00,0x0C,0x00,0x0F,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,/*"海",1*/
|
||||||
|
|
||||||
|
"信",0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x00,0x00,0xE0,0x30,0x00,
|
||||||
|
0x00,0xC0,0x18,0x00,0x00,0xC0,0x18,0x00,0x01,0x80,0x18,0x10,0x01,0xBF,0xFF,0xF8,
|
||||||
|
0x01,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x07,0x80,0x00,0x60,
|
||||||
|
0x07,0x07,0xFF,0xF0,0x0F,0x00,0x00,0x00,0x0B,0x00,0x00,0x00,0x13,0x00,0x00,0x60,
|
||||||
|
0x23,0x0F,0xFF,0xF0,0x43,0x00,0x00,0x00,0x43,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
|
||||||
|
0x03,0x06,0x00,0x60,0x03,0x07,0xFF,0xE0,0x03,0x06,0x00,0x60,0x03,0x06,0x00,0x60,
|
||||||
|
0x03,0x06,0x00,0x60,0x03,0x06,0x00,0x60,0x03,0x06,0x00,0x60,0x03,0x07,0xFF,0xE0,
|
||||||
|
0x03,0x06,0x00,0x60,0x03,0x06,0x00,0x60,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"信",4*/
|
||||||
|
|
||||||
|
"息",0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x02,0x00,0x00,
|
||||||
|
0x00,0x04,0x01,0x00,0x00,0xFF,0xFF,0xC0,0x00,0xC0,0x01,0x80,0x00,0xC0,0x01,0x80,
|
||||||
|
0x00,0xC0,0x01,0x80,0x00,0xFF,0xFF,0x80,0x00,0xC0,0x01,0x80,0x00,0xC0,0x01,0x80,
|
||||||
|
0x00,0xC0,0x01,0x80,0x00,0xFF,0xFF,0x80,0x00,0xC0,0x01,0x80,0x00,0xC0,0x01,0x80,
|
||||||
|
0x00,0xC0,0x01,0x80,0x00,0xC0,0x01,0x80,0x00,0xFF,0xFF,0x80,0x00,0x82,0x00,0x00,
|
||||||
|
0x00,0x01,0x80,0x00,0x00,0x21,0xC0,0x00,0x02,0x30,0xC0,0x40,0x02,0x30,0xC2,0x30,
|
||||||
|
0x06,0x30,0x02,0x38,0x04,0x30,0x02,0x1C,0x0C,0x30,0x02,0x1C,0x1C,0x30,0x03,0x08,
|
||||||
|
0x10,0x3F,0xFF,0x00,0x00,0x1F,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"息",5*/
|
||||||
|
|
||||||
|
"技",0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x08,0x00,0x01,0xC0,0x0E,0x00,
|
||||||
|
0x01,0x80,0x0C,0x00,0x01,0x80,0x0C,0x00,0x01,0x80,0x0C,0x00,0x01,0x80,0x0C,0x00,
|
||||||
|
0x01,0x98,0x0C,0x18,0x3F,0xFF,0xFF,0xFC,0x01,0x80,0x0C,0x00,0x01,0x80,0x0C,0x00,
|
||||||
|
0x01,0x80,0x0C,0x00,0x01,0x80,0x0C,0x00,0x01,0x8C,0x0C,0x20,0x01,0xB3,0xFF,0xF0,
|
||||||
|
0x01,0xC0,0x80,0x60,0x0F,0x80,0x80,0x60,0x3D,0x80,0x40,0xC0,0x31,0x80,0x40,0xC0,
|
||||||
|
0x01,0x80,0x21,0x80,0x01,0x80,0x21,0x80,0x01,0x80,0x33,0x00,0x01,0x80,0x1E,0x00,
|
||||||
|
0x01,0x80,0x0C,0x00,0x01,0x80,0x1E,0x00,0x01,0x80,0x37,0x00,0x01,0x80,0xE3,0xC0,
|
||||||
|
0x1F,0x83,0x80,0xF8,0x07,0x8E,0x00,0x7C,0x02,0x30,0x00,0x00,0x00,0x00,0x00,0x00,/*"技",6*/
|
||||||
|
|
||||||
|
"术",0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0xC0,0x00,
|
||||||
|
0x00,0x01,0x8C,0x00,0x00,0x01,0x87,0x00,0x00,0x01,0x83,0x80,0x00,0x01,0x81,0x80,
|
||||||
|
0x00,0x01,0x80,0x80,0x00,0x01,0x80,0x30,0x3F,0xFF,0xFF,0xF8,0x10,0x03,0xC0,0x00,
|
||||||
|
0x00,0x07,0xC0,0x00,0x00,0x07,0xA0,0x00,0x00,0x0D,0xA0,0x00,0x00,0x0D,0x90,0x00,
|
||||||
|
0x00,0x19,0x90,0x00,0x00,0x19,0x98,0x00,0x00,0x31,0x8C,0x00,0x00,0x61,0x86,0x00,
|
||||||
|
0x00,0xC1,0x87,0x00,0x00,0x81,0x83,0x80,0x01,0x81,0x81,0xC0,0x03,0x01,0x80,0xF0,
|
||||||
|
0x04,0x01,0x80,0x7C,0x08,0x01,0x80,0x38,0x10,0x01,0x80,0x10,0x60,0x01,0x80,0x00,
|
||||||
|
0x00,0x01,0x80,0x00,0x00,0x01,0x80,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,/*"术",7*/
|
||||||
|
|
||||||
|
"有",0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x03,0xC0,0x00,
|
||||||
|
0x00,0x03,0x00,0x00,0x00,0x06,0x00,0x10,0x00,0x06,0x00,0x38,0x3F,0xFF,0xFF,0xFC,
|
||||||
|
0x00,0x0C,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x30,0x01,0x00,
|
||||||
|
0x00,0x7F,0xFF,0xC0,0x00,0x60,0x01,0x00,0x00,0xE0,0x01,0x00,0x01,0xE0,0x01,0x00,
|
||||||
|
0x03,0x60,0x01,0x00,0x06,0x7F,0xFF,0x00,0x08,0x60,0x01,0x00,0x10,0x60,0x01,0x00,
|
||||||
|
0x20,0x60,0x01,0x00,0x00,0x60,0x01,0x00,0x00,0x7F,0xFF,0x00,0x00,0x60,0x01,0x00,
|
||||||
|
0x00,0x60,0x01,0x00,0x00,0x60,0x01,0x00,0x00,0x60,0x01,0x00,0x00,0x60,0x01,0x00,
|
||||||
|
0x00,0x60,0x3F,0x00,0x00,0x60,0x0F,0x00,0x00,0x40,0x02,0x00,0x00,0x00,0x00,0x00,/*"有",8*/
|
||||||
|
|
||||||
|
"限",0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x22,0x00,0x40,
|
||||||
|
0x0F,0xF3,0xFF,0xE0,0x08,0x63,0x00,0x40,0x08,0x63,0x00,0x40,0x08,0x43,0x00,0x40,
|
||||||
|
0x08,0x43,0x00,0x40,0x08,0xC3,0x00,0x40,0x08,0x83,0xFF,0xC0,0x08,0x83,0x00,0x40,
|
||||||
|
0x09,0x03,0x00,0x40,0x08,0x83,0x00,0x40,0x08,0x43,0x00,0x40,0x08,0x63,0xFF,0xC0,
|
||||||
|
0x08,0x23,0x20,0x40,0x08,0x33,0x10,0x20,0x08,0x33,0x10,0x70,0x08,0x33,0x10,0x60,
|
||||||
|
0x08,0x33,0x19,0x80,0x08,0x33,0x0B,0x00,0x0B,0xF3,0x0C,0x00,0x08,0xE3,0x06,0x00,
|
||||||
|
0x08,0x83,0x07,0x00,0x08,0x03,0x0B,0x80,0x08,0x03,0x31,0xC0,0x08,0x03,0xC0,0xF8,
|
||||||
|
0x08,0x03,0x80,0x78,0x08,0x03,0x00,0x10,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"限",9*/
|
||||||
|
|
||||||
|
"公",0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x08,0x30,0x00,
|
||||||
|
0x00,0x0C,0x20,0x00,0x00,0x1C,0x10,0x00,0x00,0x18,0x10,0x00,0x00,0x30,0x18,0x00,
|
||||||
|
0x00,0x30,0x08,0x00,0x00,0x60,0x0C,0x00,0x00,0x60,0x04,0x00,0x00,0xC0,0x06,0x00,
|
||||||
|
0x01,0x80,0x03,0x00,0x01,0x01,0x01,0x80,0x03,0x01,0x81,0xC0,0x06,0x03,0xC0,0xF0,
|
||||||
|
0x0C,0x03,0x00,0x7C,0x10,0x07,0x00,0x30,0x20,0x06,0x00,0x00,0x00,0x0C,0x00,0x00,
|
||||||
|
0x00,0x0C,0x00,0x00,0x00,0x18,0x10,0x00,0x00,0x30,0x08,0x00,0x00,0x20,0x0C,0x00,
|
||||||
|
0x00,0x40,0x06,0x00,0x00,0x80,0x03,0x00,0x01,0x00,0x03,0x80,0x03,0xFF,0xFF,0xC0,
|
||||||
|
0x03,0xE0,0x01,0xC0,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,/*"公",10*/
|
||||||
|
|
||||||
|
"司",0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,
|
||||||
|
0x07,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x60,
|
||||||
|
0x00,0x00,0x00,0x60,0x00,0x00,0x18,0x60,0x1F,0xFF,0xFC,0x60,0x00,0x00,0x00,0x60,
|
||||||
|
0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x60,0x03,0x00,0x60,0x60,0x03,0xFF,0xE0,0x60,
|
||||||
|
0x03,0x00,0x40,0x60,0x03,0x00,0x40,0x60,0x03,0x00,0x40,0x60,0x03,0x00,0x40,0x60,
|
||||||
|
0x03,0x00,0x40,0x60,0x03,0x00,0x40,0x60,0x03,0xFF,0xC0,0x60,0x03,0x00,0x40,0x60,
|
||||||
|
0x03,0x00,0x00,0x60,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x60,0x00,0x00,0x10,0x60,
|
||||||
|
0x00,0x00,0x0F,0xC0,0x00,0x00,0x01,0xC0,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,/*"司",11*/
|
||||||
|
|
||||||
|
};
|
18
FinalHomework/Core/Inc/HC595.h
Normal file
18
FinalHomework/Core/Inc/HC595.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#ifndef __HC595_H
|
||||||
|
#define __HC595_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
void SendOneByte(uint8_t dat);
|
||||||
|
void SendTwoBytes(uint16_t dat);
|
||||||
|
void HanziDiplay(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
45
FinalHomework/Core/Inc/Hanzi.h
Normal file
45
FinalHomework/Core/Inc/Hanzi.h
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
|
||||||
|
#ifndef __HANZI_H
|
||||||
|
#define __HANZI_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
const uint8_t HanziTab[] = /*"华" 16x16点阵数据*/
|
||||||
|
{0x10,0x01,0x10,0x11,0x08,0x09,0x0C,0x07,0x8A,0x01,0x69,0x21,0x08,0x21,0x08,0x3E,
|
||||||
|
0x88,0x00,0x80,0x00,0xFF,0x7F,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,/*"华",0*/
|
||||||
|
|
||||||
|
0x40,0x00,0x40,0x00,0x40,0x00,0xFE,0x3F,0x20,0x00,0x90,0x00,0x88,0x00,0x84,0x00,
|
||||||
|
0xFC,0x1F,0x80,0x00,0x90,0x04,0x88,0x08,0x84,0x10,0x82,0x20,0xA0,0x00,0x40,0x00,/*"东",1*/
|
||||||
|
0x10,0x00,0xD0,0x7F,0x12,0x04,0x12,0x04,0x12,0x04,0x92,0x3F,0x92,0x24,0x92,0x24,
|
||||||
|
0x92,0x24,0x92,0x24,0x92,0x24,0x90,0x2C,0x88,0x14,0x08,0x04,0x04,0x04,0x02,0x04,/*"师",2*/
|
||||||
|
0x20,0x02,0x20,0x02,0xFF,0x7F,0x20,0x02,0x08,0x00,0x90,0x1F,0x92,0x10,0x84,0x10,
|
||||||
|
0xA4,0x10,0xA0,0x14,0x90,0x08,0x8E,0x40,0x88,0x40,0x88,0x40,0x08,0x7F,0x00,0x00,/*"范",3*/
|
||||||
|
0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0xFF,0x7F,0x80,0x00,0x80,0x00,
|
||||||
|
0x40,0x01,0x40,0x01,0x20,0x02,0x20,0x02,0x10,0x04,0x08,0x08,0x04,0x10,0x03,0x60,/*"大",4*/
|
||||||
|
0x44,0x10,0x88,0x10,0x88,0x08,0x00,0x04,0xFE,0x7F,0x02,0x40,0x01,0x20,0xF8,0x07,
|
||||||
|
0x00,0x02,0x80,0x01,0xFF,0x7F,0x80,0x00,0x80,0x00,0x80,0x00,0xA0,0x00,0x40,0x00,/*"学",5*/
|
||||||
|
0x00,0x00,0xE2,0x1F,0x04,0x08,0x84,0x05,0x00,0x02,0xE0,0x3F,0x27,0x22,0x24,0x22,
|
||||||
|
0xE4,0x3F,0x24,0x22,0x24,0x22,0xE4,0x3F,0x24,0x22,0x24,0x2A,0x2A,0x10,0xF1,0x7F,/*"通",6*/
|
||||||
|
0x10,0x02,0x10,0x04,0xD0,0x7F,0x08,0x00,0x08,0x00,0x8C,0x3F,0x0C,0x00,0x0A,0x00,
|
||||||
|
0x89,0x3F,0x08,0x00,0x08,0x00,0x88,0x3F,0x88,0x20,0x88,0x20,0x88,0x3F,0x88,0x20,/*"信",7*/
|
||||||
|
0x08,0x00,0x08,0x00,0x08,0x00,0xF8,0x3F,0x08,0x00,0x04,0x00,0x04,0x00,0xFC,0x1F,
|
||||||
|
0x00,0x10,0x00,0x10,0x00,0x10,0xFF,0x13,0x00,0x10,0x00,0x10,0x00,0x0A,0x00,0x04,/*"与",8*/
|
||||||
|
0x80,0x00,0x80,0x00,0x80,0x00,0xFC,0x1F,0x84,0x10,0x84,0x10,0x84,0x10,0xFC,0x1F,
|
||||||
|
0x84,0x10,0x84,0x10,0x84,0x10,0xFC,0x1F,0x84,0x50,0x80,0x40,0x80,0x40,0x00,0x7F,/*"电",9*/
|
||||||
|
0x00,0x00,0xFE,0x1F,0x00,0x08,0x00,0x04,0x00,0x02,0x80,0x01,0x80,0x00,0xFF,0x7F,
|
||||||
|
0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0xA0,0x00,0x40,0x00,/*"子",10*/
|
||||||
|
0x00,0x00,0x00,0x00,0xFE,0x3F,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,
|
||||||
|
0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0xFF,0x7F,0x00,0x00,0x00,0x00,/*"工",11*/
|
||||||
|
0x10,0x00,0xB8,0x3F,0x8F,0x20,0x88,0x20,0x88,0x20,0xBF,0x3F,0x08,0x00,0x0C,0x00,
|
||||||
|
0x9C,0x7F,0x2A,0x04,0x2A,0x04,0x89,0x3F,0x08,0x04,0x08,0x04,0xC8,0x7F,0x08,0x00,/*"程",12*/
|
||||||
|
0x44,0x10,0x88,0x10,0x88,0x08,0x00,0x04,0xFE,0x7F,0x02,0x40,0x01,0x20,0xF8,0x07,
|
||||||
|
0x00,0x02,0x80,0x01,0xFF,0x7F,0x80,0x00,0x80,0x00,0x80,0x00,0xA0,0x00,0x40,0x00,/*"学",13*/
|
||||||
|
0x00,0x02,0x1E,0x04,0xD2,0x7F,0x4A,0x40,0x2A,0x20,0x86,0x1F,0x0A,0x00,0x12,0x00,
|
||||||
|
0xD2,0x7F,0x12,0x09,0x16,0x09,0x0A,0x09,0x82,0x48,0x82,0x48,0x42,0x70,0x22,0x00};/*"院",14*/
|
||||||
|
|
||||||
|
|
||||||
|
uint16_t const ScanTab[] =
|
||||||
|
{0x00001,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,
|
||||||
|
0x0100,0x0200,0x0400,0x0800,0x1000,0x2000,0x4000,0x8000};
|
||||||
|
|
||||||
|
#endif
|
@ -77,6 +77,14 @@ void Error_Handler(void);
|
|||||||
#define LCD_CS_GPIO_Port GPIOB
|
#define LCD_CS_GPIO_Port GPIOB
|
||||||
#define LCD_RS_Pin GPIO_PIN_14
|
#define LCD_RS_Pin GPIO_PIN_14
|
||||||
#define LCD_RS_GPIO_Port GPIOB
|
#define LCD_RS_GPIO_Port GPIOB
|
||||||
|
#define HC595_OE_Pin GPIO_PIN_6
|
||||||
|
#define HC595_OE_GPIO_Port GPIOC
|
||||||
|
#define HC595_RCLK_Pin GPIO_PIN_7
|
||||||
|
#define HC595_RCLK_GPIO_Port GPIOC
|
||||||
|
#define HC595_SRCLK_Pin GPIO_PIN_8
|
||||||
|
#define HC595_SRCLK_GPIO_Port GPIOC
|
||||||
|
#define HC595_SER_Pin GPIO_PIN_9
|
||||||
|
#define HC595_SER_GPIO_Port GPIOC
|
||||||
#define KeyRow_Pin GPIO_PIN_4
|
#define KeyRow_Pin GPIO_PIN_4
|
||||||
#define KeyRow_GPIO_Port GPIOB
|
#define KeyRow_GPIO_Port GPIOB
|
||||||
|
|
||||||
|
82
FinalHomework/Core/Src/HC595.c
Normal file
82
FinalHomework/Core/Src/HC595.c
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
#include "main.h"
|
||||||
|
#include "Hanzi.h"
|
||||||
|
|
||||||
|
#define HC595_PORT GPIOC
|
||||||
|
|
||||||
|
//GPIO置位(拉高)
|
||||||
|
#define OE_SET HC595_PORT->BSRR=HC595_OE_Pin
|
||||||
|
#define RCLK_SET HC595_PORT->BSRR=HC595_RCLK_Pin
|
||||||
|
#define SRCLK_SET HC595_PORT->BSRR=HC595_SRCLK_Pin
|
||||||
|
#define SER_SET HC595_PORT->BSRR=HC595_SER_Pin
|
||||||
|
|
||||||
|
//GPIO复位(拉低)
|
||||||
|
#define OE_CLR HC595_PORT->BRR=HC595_OE_Pin
|
||||||
|
#define RCLK_CLR HC595_PORT->BRR=HC595_RCLK_Pin
|
||||||
|
#define SRCLK_CLR HC595_PORT->BRR=HC595_SRCLK_Pin
|
||||||
|
#define SER_CLR HC595_PORT->BRR=HC595_SER_Pin
|
||||||
|
|
||||||
|
#define LATCH595 {RCLK_CLR;RCLK_SET;RCLK_CLR;}
|
||||||
|
|
||||||
|
extern uint8_t mPos;
|
||||||
|
extern uint8_t mNum;
|
||||||
|
|
||||||
|
void SendOneByte(uint8_t dat)
|
||||||
|
{
|
||||||
|
uint8_t i;
|
||||||
|
OE_CLR;
|
||||||
|
for(i=0;i<8;i++)
|
||||||
|
{
|
||||||
|
if((dat&0x80))
|
||||||
|
SER_SET;
|
||||||
|
else
|
||||||
|
SER_CLR;
|
||||||
|
dat <<= 1;
|
||||||
|
SRCLK_CLR;//SRCLK=0;
|
||||||
|
SRCLK_SET;// SRCLK=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************
|
||||||
|
SendTwoBytes(uint16_t dat,bit dir)
|
||||||
|
函数功能:向HC595芯片发送两个字节
|
||||||
|
入口参数:dat:发送数据,dir:1:先发高位;0:先发低位
|
||||||
|
返回参数:无
|
||||||
|
********************************************************/
|
||||||
|
void SendTwoBytes(uint16_t dat)
|
||||||
|
{
|
||||||
|
|
||||||
|
uint8_t i;
|
||||||
|
OE_CLR;
|
||||||
|
for(i=0;i<16;i++)
|
||||||
|
{
|
||||||
|
if((dat &0x8000))
|
||||||
|
SER_SET;
|
||||||
|
else
|
||||||
|
SER_CLR;
|
||||||
|
dat <<= 1;
|
||||||
|
|
||||||
|
SRCLK_CLR;//SRCLK=0;
|
||||||
|
SRCLK_SET;// SRCLK=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************
|
||||||
|
//函数名称:HanziDiplay()
|
||||||
|
//函数功能:静态显示一个汉字
|
||||||
|
//入口参数:无
|
||||||
|
//返回参数:无
|
||||||
|
********************************************************/
|
||||||
|
void HanziDiplay(void)
|
||||||
|
{
|
||||||
|
uint16_t temp;
|
||||||
|
SendTwoBytes(ScanTab[mPos]);
|
||||||
|
temp=HanziTab[2*mPos+1+32*mNum];
|
||||||
|
temp=(temp<<8)|HanziTab[2*mPos+32*mNum];
|
||||||
|
SendTwoBytes(temp);
|
||||||
|
LATCH595;
|
||||||
|
if(++mPos>=16)
|
||||||
|
{
|
||||||
|
mPos=0;
|
||||||
|
}
|
||||||
|
}
|
@ -52,7 +52,8 @@ void MX_GPIO_Init(void)
|
|||||||
|
|
||||||
/*Configure GPIO pin Output Level */
|
/*Configure GPIO pin Output Level */
|
||||||
HAL_GPIO_WritePin(GPIOC, TickLed_Pin|AddrA_Pin|AddrB_Pin|AddrC_Pin
|
HAL_GPIO_WritePin(GPIOC, TickLed_Pin|AddrA_Pin|AddrB_Pin|AddrC_Pin
|
||||||
|OE_Pin, GPIO_PIN_RESET);
|
|OE_Pin|HC595_OE_Pin|HC595_RCLK_Pin|HC595_SRCLK_Pin
|
||||||
|
|HC595_SER_Pin, GPIO_PIN_RESET);
|
||||||
|
|
||||||
/*Configure GPIO pin Output Level */
|
/*Configure GPIO pin Output Level */
|
||||||
HAL_GPIO_WritePin(GPIOA, SegLedData_Pin|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3
|
HAL_GPIO_WritePin(GPIOA, SegLedData_Pin|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3
|
||||||
@ -94,30 +95,13 @@ void MX_GPIO_Init(void)
|
|||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||||
|
|
||||||
/*Configure GPIO pin : PC6 */
|
/*Configure GPIO pins : PCPin PCPin PCPin PCPin */
|
||||||
GPIO_InitStruct.Pin = GPIO_PIN_6;
|
GPIO_InitStruct.Pin = HC595_OE_Pin|HC595_RCLK_Pin|HC595_SRCLK_Pin|HC595_SER_Pin;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
|
||||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
|
||||||
|
|
||||||
/*Configure GPIO pins : PC7 PC8 PC9 */
|
|
||||||
GPIO_InitStruct.Pin = GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_9;
|
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
|
||||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||||
|
|
||||||
/*Configure GPIO pin : PA8 */
|
|
||||||
GPIO_InitStruct.Pin = GPIO_PIN_8;
|
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
|
||||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
|
||||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
|
||||||
|
|
||||||
/*Configure GPIO pins : PA9 PA10 PA11 */
|
|
||||||
GPIO_InitStruct.Pin = GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_11;
|
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
|
||||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
|
||||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* USER CODE BEGIN 2 */
|
/* USER CODE BEGIN 2 */
|
||||||
|
@ -49,6 +49,10 @@
|
|||||||
/* Private variables ---------------------------------------------------------*/
|
/* Private variables ---------------------------------------------------------*/
|
||||||
|
|
||||||
/* USER CODE BEGIN PV */
|
/* USER CODE BEGIN PV */
|
||||||
|
uint16_t mPos=0;
|
||||||
|
|
||||||
|
uint16_t mNum=0;
|
||||||
|
|
||||||
stSysTickTimer sSysTickTimer = {
|
stSysTickTimer sSysTickTimer = {
|
||||||
0, 0, 0, 0
|
0, 0, 0, 0
|
||||||
};
|
};
|
||||||
@ -84,6 +88,7 @@ int main(void)
|
|||||||
|
|
||||||
/* USER CODE BEGIN 1 */
|
/* USER CODE BEGIN 1 */
|
||||||
uint8_t KeyValue = 0;
|
uint8_t KeyValue = 0;
|
||||||
|
uint16_t cnt = 0;
|
||||||
/* USER CODE END 1 */
|
/* USER CODE END 1 */
|
||||||
|
|
||||||
/* MCU Configuration--------------------------------------------------------*/
|
/* MCU Configuration--------------------------------------------------------*/
|
||||||
@ -121,6 +126,12 @@ int main(void)
|
|||||||
/* USER CODE BEGIN 3 */
|
/* USER CODE BEGIN 3 */
|
||||||
if (sSysTickTimer.bTenMilSecOk) {
|
if (sSysTickTimer.bTenMilSecOk) {
|
||||||
sSysTickTimer.bTenMilSecOk = 0;
|
sSysTickTimer.bTenMilSecOk = 0;
|
||||||
|
if(++cnt>=30)
|
||||||
|
{
|
||||||
|
cnt=0;
|
||||||
|
if(++mNum>=6)
|
||||||
|
mNum=0;
|
||||||
|
}
|
||||||
KeyValue = MatrixKeyScan();
|
KeyValue = MatrixKeyScan();
|
||||||
if (KeyValue != NO_KEY) {
|
if (KeyValue != NO_KEY) {
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
/* Private includes ----------------------------------------------------------*/
|
/* Private includes ----------------------------------------------------------*/
|
||||||
/* USER CODE BEGIN Includes */
|
/* USER CODE BEGIN Includes */
|
||||||
#include "variable.h"
|
#include "variable.h"
|
||||||
|
#include "hc595.h"
|
||||||
/* USER CODE END Includes */
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
/* Private typedef -----------------------------------------------------------*/
|
/* Private typedef -----------------------------------------------------------*/
|
||||||
@ -190,6 +191,7 @@ void SysTick_Handler(void)
|
|||||||
/* USER CODE END SysTick_IRQn 0 */
|
/* USER CODE END SysTick_IRQn 0 */
|
||||||
HAL_IncTick();
|
HAL_IncTick();
|
||||||
/* USER CODE BEGIN SysTick_IRQn 1 */
|
/* USER CODE BEGIN SysTick_IRQn 1 */
|
||||||
|
HanziDiplay();
|
||||||
if (++sSysTickTimer.mMilSecCount >= 10) {
|
if (++sSysTickTimer.mMilSecCount >= 10) {
|
||||||
sSysTickTimer.mMilSecCount = 0;
|
sSysTickTimer.mMilSecCount = 0;
|
||||||
sSysTickTimer.bTenMilSecOk = 1;
|
sSysTickTimer.bTenMilSecOk = 1;
|
||||||
|
@ -35,28 +35,24 @@ Mcu.Pin23=PC6
|
|||||||
Mcu.Pin24=PC7
|
Mcu.Pin24=PC7
|
||||||
Mcu.Pin25=PC8
|
Mcu.Pin25=PC8
|
||||||
Mcu.Pin26=PC9
|
Mcu.Pin26=PC9
|
||||||
Mcu.Pin27=PA8
|
Mcu.Pin27=PA13
|
||||||
Mcu.Pin28=PA9
|
Mcu.Pin28=PA14
|
||||||
Mcu.Pin29=PA10
|
Mcu.Pin29=PB3
|
||||||
Mcu.Pin3=PC0
|
Mcu.Pin3=PC0
|
||||||
Mcu.Pin30=PA11
|
Mcu.Pin30=PB4
|
||||||
Mcu.Pin31=PA13
|
Mcu.Pin31=PB5
|
||||||
Mcu.Pin32=PA14
|
Mcu.Pin32=PB6
|
||||||
Mcu.Pin33=PB3
|
Mcu.Pin33=PB7
|
||||||
Mcu.Pin34=PB4
|
Mcu.Pin34=VP_SYS_VS_Systick
|
||||||
Mcu.Pin35=PB5
|
Mcu.Pin35=VP_SYS_VS_DBSignals
|
||||||
Mcu.Pin36=PB6
|
Mcu.Pin36=VP_TIM3_VS_ClockSourceINT
|
||||||
Mcu.Pin37=PB7
|
|
||||||
Mcu.Pin38=VP_SYS_VS_Systick
|
|
||||||
Mcu.Pin39=VP_SYS_VS_DBSignals
|
|
||||||
Mcu.Pin4=PC1
|
Mcu.Pin4=PC1
|
||||||
Mcu.Pin40=VP_TIM3_VS_ClockSourceINT
|
|
||||||
Mcu.Pin5=PC2
|
Mcu.Pin5=PC2
|
||||||
Mcu.Pin6=PC3
|
Mcu.Pin6=PC3
|
||||||
Mcu.Pin7=PA0
|
Mcu.Pin7=PA0
|
||||||
Mcu.Pin8=PA1
|
Mcu.Pin8=PA1
|
||||||
Mcu.Pin9=PA2
|
Mcu.Pin9=PA2
|
||||||
Mcu.PinsNb=41
|
Mcu.PinsNb=37
|
||||||
Mcu.ThirdPartyNb=0
|
Mcu.ThirdPartyNb=0
|
||||||
Mcu.UserConstants=
|
Mcu.UserConstants=
|
||||||
Mcu.UserName=STM32G473RCTx
|
Mcu.UserName=STM32G473RCTx
|
||||||
@ -85,14 +81,6 @@ PA1.GPIO_PuPd=GPIO_PULLUP
|
|||||||
PA1.Locked=true
|
PA1.Locked=true
|
||||||
PA1.PinState=GPIO_PIN_SET
|
PA1.PinState=GPIO_PIN_SET
|
||||||
PA1.Signal=GPIO_Output
|
PA1.Signal=GPIO_Output
|
||||||
PA10.GPIOParameters=GPIO_PuPd
|
|
||||||
PA10.GPIO_PuPd=GPIO_PULLUP
|
|
||||||
PA10.Locked=true
|
|
||||||
PA10.Signal=GPIO_Input
|
|
||||||
PA11.GPIOParameters=GPIO_PuPd
|
|
||||||
PA11.GPIO_PuPd=GPIO_PULLUP
|
|
||||||
PA11.Locked=true
|
|
||||||
PA11.Signal=GPIO_Input
|
|
||||||
PA13.Mode=Serial_Wire
|
PA13.Mode=Serial_Wire
|
||||||
PA13.Signal=SYS_JTMS-SWDIO
|
PA13.Signal=SYS_JTMS-SWDIO
|
||||||
PA14.Mode=Serial_Wire
|
PA14.Mode=Serial_Wire
|
||||||
@ -127,12 +115,6 @@ PA7.GPIO_PuPd=GPIO_PULLUP
|
|||||||
PA7.Locked=true
|
PA7.Locked=true
|
||||||
PA7.PinState=GPIO_PIN_SET
|
PA7.PinState=GPIO_PIN_SET
|
||||||
PA7.Signal=GPIO_Output
|
PA7.Signal=GPIO_Output
|
||||||
PA8.Locked=true
|
|
||||||
PA8.Signal=GPIO_Input
|
|
||||||
PA9.GPIOParameters=GPIO_PuPd
|
|
||||||
PA9.GPIO_PuPd=GPIO_PULLUP
|
|
||||||
PA9.Locked=true
|
|
||||||
PA9.Signal=GPIO_Input
|
|
||||||
PB0.GPIOParameters=GPIO_PuPd,GPIO_Label
|
PB0.GPIOParameters=GPIO_PuPd,GPIO_Label
|
||||||
PB0.GPIO_Label=KeyLine
|
PB0.GPIO_Label=KeyLine
|
||||||
PB0.GPIO_PuPd=GPIO_PULLUP
|
PB0.GPIO_PuPd=GPIO_PULLUP
|
||||||
@ -214,20 +196,30 @@ PC3.GPIO_Label=OE
|
|||||||
PC3.GPIO_PuPd=GPIO_PULLUP
|
PC3.GPIO_PuPd=GPIO_PULLUP
|
||||||
PC3.Locked=true
|
PC3.Locked=true
|
||||||
PC3.Signal=GPIO_Output
|
PC3.Signal=GPIO_Output
|
||||||
|
PC6.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label
|
||||||
|
PC6.GPIO_Label=HC595_OE
|
||||||
|
PC6.GPIO_PuPd=GPIO_PULLUP
|
||||||
|
PC6.GPIO_Speed=GPIO_SPEED_FREQ_HIGH
|
||||||
PC6.Locked=true
|
PC6.Locked=true
|
||||||
PC6.Signal=GPIO_Input
|
PC6.Signal=GPIO_Output
|
||||||
PC7.GPIOParameters=GPIO_PuPd
|
PC7.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label
|
||||||
|
PC7.GPIO_Label=HC595_RCLK
|
||||||
PC7.GPIO_PuPd=GPIO_PULLUP
|
PC7.GPIO_PuPd=GPIO_PULLUP
|
||||||
|
PC7.GPIO_Speed=GPIO_SPEED_FREQ_HIGH
|
||||||
PC7.Locked=true
|
PC7.Locked=true
|
||||||
PC7.Signal=GPIO_Input
|
PC7.Signal=GPIO_Output
|
||||||
PC8.GPIOParameters=GPIO_PuPd
|
PC8.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label
|
||||||
|
PC8.GPIO_Label=HC595_SRCLK
|
||||||
PC8.GPIO_PuPd=GPIO_PULLUP
|
PC8.GPIO_PuPd=GPIO_PULLUP
|
||||||
|
PC8.GPIO_Speed=GPIO_SPEED_FREQ_HIGH
|
||||||
PC8.Locked=true
|
PC8.Locked=true
|
||||||
PC8.Signal=GPIO_Input
|
PC8.Signal=GPIO_Output
|
||||||
PC9.GPIOParameters=GPIO_PuPd
|
PC9.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label
|
||||||
|
PC9.GPIO_Label=HC595_SER
|
||||||
PC9.GPIO_PuPd=GPIO_PULLUP
|
PC9.GPIO_PuPd=GPIO_PULLUP
|
||||||
|
PC9.GPIO_Speed=GPIO_SPEED_FREQ_HIGH
|
||||||
PC9.Locked=true
|
PC9.Locked=true
|
||||||
PC9.Signal=GPIO_Input
|
PC9.Signal=GPIO_Output
|
||||||
PF0-OSC_IN.Mode=HSE-External-Oscillator
|
PF0-OSC_IN.Mode=HSE-External-Oscillator
|
||||||
PF0-OSC_IN.Signal=RCC_OSC_IN
|
PF0-OSC_IN.Signal=RCC_OSC_IN
|
||||||
PF1-OSC_OUT.Mode=HSE-External-Oscillator
|
PF1-OSC_OUT.Mode=HSE-External-Oscillator
|
||||||
|
@ -458,6 +458,36 @@
|
|||||||
<FileType>5</FileType>
|
<FileType>5</FileType>
|
||||||
<FilePath>..\Core\Inc\MatrixKey.h</FilePath>
|
<FilePath>..\Core\Inc\MatrixKey.h</FilePath>
|
||||||
</File>
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>HC595.h</FileName>
|
||||||
|
<FileType>5</FileType>
|
||||||
|
<FilePath>..\Core\Inc\HC595.h</FilePath>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>Hanzi.h</FileName>
|
||||||
|
<FileType>5</FileType>
|
||||||
|
<FilePath>..\Core\Inc\Hanzi.h</FilePath>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>GB1616.h</FileName>
|
||||||
|
<FileType>5</FileType>
|
||||||
|
<FilePath>..\Core\Inc\GB1616.h</FilePath>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>GB3232.h</FileName>
|
||||||
|
<FileType>5</FileType>
|
||||||
|
<FilePath>..\Core\Inc\GB3232.h</FilePath>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>8X16.h</FileName>
|
||||||
|
<FileType>5</FileType>
|
||||||
|
<FilePath>..\Core\Inc\8X16.h</FilePath>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>HC595.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\Core\Src\HC595.c</FilePath>
|
||||||
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>main.c</FileName>
|
<FileName>main.c</FileName>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
|
Loading…
Reference in New Issue
Block a user