MSP-LAB实训-16x16点阵显示综合例程 实验要求: 1、使用MSP-LAB实验系统上的16x16点阵间隔显示中文字符串:”全新TI电赛训练套件”; 2、在四位数码管显示实时时钟; 题意分析及程序框架设计: 1、根据图一的点阵原理图得知,四个8x8点阵分别由POS1~POS16、NEG1~NEG16连接和驱动; 2、如果全部采用GPIO驱动POSx、NEGx,单片机管脚是不够的,所幸原理图中显示,这些信号也同时被四个移位寄存器74HC595所驱动,所以,只要单片机的GPIO驱动行移位寄存器组和列移位寄存器组即可。从原理图查看得知,行列移位所需的所有信号脚都连接在J15,单片机只要与图一中红色圆圈中的J15的相应管脚连接即可; 3、由图二原理图得知,四位移位数码管的数字输入由J11通过U15的74HC573驱动数码管输入,因此需要将U15的LE脚接高,即J8的2脚接到3脚,而J11与单片机的Px口连接;
4、为了节省管脚资源,四位移位数码管的位选择线由图三的三八译码芯片74HC138驱动,单片机控制J6的2、3、4管脚即可; 5、本题中还有一个重要的实现内容是中文字库的产生和数码管字库设计,其中数码管字库设计及其实现原理由例程1.3详细介绍,这里不详细描述,而中文点阵字库可以使用在线字库生成器协助,本例题采用http://www.lixin.me/wordmodel/ 生成中文字库,但其中“TI”则自己手工绘制并填写字模; 6、16x16点阵扫描原理则是在例程1.4的8x8点阵基础上扩展,为了稳定显示,本例程采用Timer0中断,其中CCR0中断设置为78us一次,这样,78us*16*16=19.968ms一次完整的扫描,即50HZ扫描一次; 7、而采用Timer1中断控制RTC的计数,4ms一次中断,两个四位数码管即8位数码管扫描输出一次,共花32ms; 程序设计实现: 1、硬件连线: (1) P1.0~P1.2分别连接J6的4、3、2管脚; (2) P2.0~P2.7分别连接J16的1~8管脚; (3) P3.0~P3.7分别连接J11的1~8管脚; (4) J8的2、3管脚互相连接;
连接示意图见 2、程序设计: (1) Grace设计: ① Timer0 设计图
② Timer1 设计:
③ GPIO 设计
(2) CCS工程设计 ① Timer0 中断**程序
② 数码管字库设计程序
③ Timer1 中断**程序
④ 点阵固定显示字符为 unsigned char Buf[9][32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