




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、2014-2015学年第1学期嵌入式操作系统课程设计报告【设计题目】矩阵LED字符显示控制系统设计【设计目的】1掌握无操作系统下的硬件软件设计原理和方法;2进一步熟悉ARM 处理器的基本结构、指令集、存储系统以及基本接口编程;3熟悉嵌入式系统各部件的硬件初始化过程以及基本IO控制方法。4掌握矩阵LED 的应用原理【设计内容】1利用sys_init初始化程序,利用串口实现PC和开发板的数据通信;2编写S3C2410X 处理器的点阵屏驱动程序;3编写S3C2410X 处理器的点阵屏应用程序。4. 当程序运行等待要求从串口输入学生姓名的字符串在矩阵LED上显示出来。【实验环境】硬件:Embest E
2、duKit-IV 平台,ULINK2 仿真器套件,PC 机;软件:Vision IDE for ARM 集成开发环境,Windows XP。【相关知识综述】背景知识、原理算法等一、硬件部分1点阵屏的结构电路图1点阵屏的结构电路图上QL1-QL16为行驱动信号,每个信号控制一行, LR1LR16 是点阵屏的列驱动信号,每一个信号控制一列。当行信号为高电平而列信号为低电平,对应的LED就会亮。CD40941#芯片LL1LL8LL7RSTRDATACLKSTROBECD40942#芯片LL9LL16LL15DATACLKGPB5LQSGPC0GPD10GPB4GPG8STROBELOELOELSTR
3、列锁存信号2,S3C2410与点阵屏的连接CD40941#芯片LL1LL8LL7RSTRDATACLKSTROBECD40942#芯片LL9LL16LL15DATACLKGPB5LQSGPC0GPD10GPB4GPG8STROBELOELOELSTR列锁存信号图2 S3C2410ARM处理器与两片CD4094连接得到16位行选信号图以上电路可以通过S3C2410GPIO口把CPU的并行数据(16位两个字节的数据)打入到两个CD4094芯片中并锁存起来变成LL1-LL16的行选信号。各信号的作用如下表1; 2410引脚CD4094信号电平高低各信号的作用GPB4STORBE(RSTR)高行锁存允
4、许,将串行数据大入到CD4094相应位低不锁存GPB5LOE高CD4094 上锁存的并行数据全部输出(输出使能)低CD4094 上锁存的并行数据不输出GPD10CLK高CD4094 允许串行输入的数据发生变化低CD4094 不允许串行输入的数据发生变化GPC0DATA高表明串行数据为1低表明串行数据为0GPG8STORBELSTR高列锁存允许,将串行数据大入到CD4094相应位低不锁存3点阵屏的保护电路图3 点阵屏的保护电路图为了保护LED屏加了对应的电阻实现行限流作用,即LL1-LL16变为RQ1-RQ164LED的驱动 加入行驱动电路的目的是实现LED灯的驱动。这样由RQ1-RQ16变为行
5、驱动信号QL1-QL16。Q11-QL16为图1中的行驱动信号。图4 行驱动电路【设计思路】采用的数据结构、主要的函数说明、程序流程设计图等主要的函数说明:led_init(); :LED显示矩阵初始化static void refresh_l_display_array(u8 bits, u8 *str) :显示字符void led_logo_disp(void) :显示logostruct fonts_struct unsigned char ascii_width;unsigned char ascii_height;unsigned char * ascii_code;unsigned
6、 char ascii_beg;unsigned char ascii_end;【源程序清单】/* File:main.c* Author:embest* Desc:c main entry* History:*/*-*/* include files */*-*/#include "2410lib.h"#include "sys_init.h"#include "fonts.h"#include "led16x16.h"/* name:main* func:c code entry* para:none* ret
7、:none* modify:* comment:*/int main(void) char c; sys_init();/ Initial systemwhile(1)uart_printf("n Please Look At The 16X16 LEDS And Choose Keyn");uart_printf("1、向左移动n");uart_printf("2、向左闪烁移动n");uart_printf("3、向右移动n");uart_printf("4、向右闪烁移动n"); c=uart
8、_getch(); uart_printf("%c",c); led_init(); / Initial led diplay if(c='1') l_char_out(0,"_学号"); left_out(0,"abcdef"); else if(c='2') l_flash_char_out(0,"_学号"); left_out_flash(0,"abcdef"); else if(c='3') r_char_out(0,"_学号&q
9、uot;);right_out(0,"abcdef"); else if(c='4') r_flash_char_out(0,"_学号"); right_out_flash(0,"abcdef"); /* File:Dotled.c* Author:embest* Desc:DotLed_Test * History:*/*-*/* include files */*-*/#include <stdio.h>#include "2410lib.h"#include "fonts
10、.h"#include "led16x16.h"/*-*/* function declare */*-*/extern void led_char_disp(void);/*-*/* global variables */*-*/u8 l_display_array2*16;u8 assic_buffer3*16;/*=l_display_array:+-+-+| | | | D | E | | | | +-+-+A buffer data and B buffer data ->D buffer dataB buffer data and C buffe
11、r data ->E buffer dataassic_buffer:+-+-+-+| | | | A | B | C |<- update the C buffer and move the B buffer data to the A buffer| | | | and move the C buffer data to the B buffer data+-+-+-+=*/* name:led_update* func:refresh the led display* para:none* ret:none* modify:* comment:*/static void le
12、d_update(void)int j = 20;while(j-)led_char_disp();/* name:l_display_scroll* func:shift the display* para:bits:the position str:point the buffer* ret:none* modify:* comment:*/static void refresh_l_display_array(u8 bits, u8 *str)u32 i;u32 remaining_bits = 8-bits; for(i=0;i<16;i+)l_display_array2*i
13、= (*str<<bits) |(*(str+16)>>remaining_bits);l_display_array2*(i+1)-1 = (*(str+16)<<bits) |(*(str+32)>>remaining_bits);str+; static void refresh_flash_display_array(u8 bits, u8 *str)u32 i;for(i=0;i<16;i+)l_display_array2*i = 0;l_display_array2*(i+1)-1 =0;str+;/* name:l_disp
14、lay_scroll* func:scroll the display* para:str:point the buffer* ret:none* modify:* comment:*/static void l_display_scroll ( u8 *str )int i;for(i=0;i<8;i+)refresh_l_display_array(i, str);led_update(); static void l_flash_display_scroll ( u8 *str )int i;for(i=0;i<8;i+)refresh_l_display_array(i,
15、str);led_update();refresh_flash_display_array(i, str);led_update();static void r_display_scroll ( u8 *str )int i;for(i=8;i>0;i-)refresh_l_display_array(i, str);led_update(); static void r_flash_display_scroll ( u8 *str )int i;for(i=8;i>0;i-)refresh_l_display_array(i, str);led_update();refresh_
16、flash_display_array(i, str);led_update();/* name:copy_data* func:copy data* para:dst:point the dest data src:points the source data* ret:none* modify:* comment:*/static void copy_data(u8 *dst, u8 *src, u32 size)while(size-)*(dst+) = *(src+);/* name:refresh_assic_buffer* func:refresh buffer* para:str
17、:points the new char* ret:none* modify:* comment:*/static void l_refresh_assic_buffer(u8 *str)copy_data(&assic_buffer0, &assic_buffer16,16);copy_data(&assic_buffer16, &assic_buffer32,16);copy_data(&assic_buffer32, str,16);l_display_scroll(assic_buffer);static void l_flash_refresh
18、_assic_buffer(u8 *str)copy_data(&assic_buffer0, &assic_buffer16,16);copy_data(&assic_buffer16, &assic_buffer32,16);copy_data(&assic_buffer32, str,16);l_flash_display_scroll(assic_buffer);static void r_refresh_assic_buffer(u8 *str)copy_data(&assic_buffer32, &assic_buffer16
19、,16);copy_data(&assic_buffer16, &assic_buffer0,16);copy_data(&assic_buffer0, str,16);r_display_scroll(assic_buffer);static void r_flash_refresh_assic_buffer(u8 *str)copy_data(&assic_buffer32, &assic_buffer16,16);copy_data(&assic_buffer16, &assic_buffer0,16);copy_data(&
20、;assic_buffer0, str,16);r_flash_display_scroll(assic_buffer);/* name:char_out* func:display the chars* para:font:0 str:points of the chars* ret:none* modify:* comment:*/ void l_char_out(u8 font, u8 *str)u8 *str_ptr;u8 glyph;glyph = ( u8 )*str;while(glyph != '0' )str_ptr = fontsfont.ascii_cod
21、e + ( glyph - fontsfont.ascii_beg) * fontsfont.ascii_height;l_refresh_assic_buffer(str_ptr);str+;glyph = ( u8 )*str;void l_flash_char_out(u8 font, u8 *str)u8 *str_ptr;u8 glyph;glyph = ( u8 )*str;while(glyph != '0' )str_ptr = fontsfont.ascii_code + ( glyph - fontsfont.ascii_beg) * fontsfont.a
22、scii_height;l_flash_refresh_assic_buffer(str_ptr);str+;glyph = ( u8 )*str;void r_char_out(u8 font, u8 *str)u8 *str_ptr;u8 glyph;glyph = ( u8 )*str;while(glyph != '0' )str_ptr = fontsfont.ascii_code + ( glyph - fontsfont.ascii_beg) * fontsfont.ascii_height;r_refresh_assic_buffer(str_ptr);str+
23、;glyph = ( u8 )*str;void r_flash_char_out(u8 font, u8 *str)u8 *str_ptr;u8 glyph;glyph = ( u8 )*str;while(glyph != '0' )str_ptr = fontsfont.ascii_code + ( glyph - fontsfont.ascii_beg) * fontsfont.ascii_height;r_flash_refresh_assic_buffer(str_ptr);str+;glyph = ( u8 )*str;void left_out(u8 font,
24、 u8 *str)u8 *str_ptr;u8 glyph;glyph = ( u8 )*str;while(glyph != '0' )str_ptr = leftcodefont.ascii_code + ( glyph - leftcodefont.ascii_beg) * leftcodefont.ascii_height;l_refresh_assic_buffer(str_ptr);str+;glyph = ( u8 )*str; void left_out_flash(u8 font, u8 *str)u8 *str_ptr;u8 glyph;glyph = (
25、u8 )*str;while(glyph != '0' )str_ptr = leftcodefont.ascii_code + ( glyph - leftcodefont.ascii_beg) * leftcodefont.ascii_height;l_flash_refresh_assic_buffer(str_ptr);str+;glyph = ( u8 )*str;void right_out(u8 font, u8 *str)u8 *str_ptr;u8 glyph;glyph = ( u8 )*str;while(glyph != '0' )str
26、_ptr = rightcodefont.ascii_code + ( glyph - rightcodefont.ascii_beg) * rightcodefont.ascii_height;r_refresh_assic_buffer(str_ptr);str+;glyph = ( u8 )*str; void right_out_flash(u8 font, u8 *str)u8 *str_ptr;u8 glyph;glyph = ( u8 )*str;while(glyph != '0' )str_ptr = rightcodefont.ascii_code + (
27、glyph - rightcodefont.ascii_beg) * rightcodefont.ascii_height;r_flash_refresh_assic_buffer(str_ptr);str+;glyph = ( u8 )*str;/* name:led_init* func:initial the led display* para:none* ret:none* modify:* comment:*/void led_init(void)rGPBCON = rGPBCON & 0xfff0ff | 0x500; / GPB4,GPB5=01:OutputrGPCCO
28、N = rGPCCON & 0xffff3ffc | 0x4001; / GPC0,GPC7=01:OutputrGPDCON = rGPDCON & 0xffcfffff | 0x100000; / GPD10=01:OutputrGPGCON = rGPGCON & 0xfffcffff | 0x10000; / GPG8=01:Output/* File:fonts.c* Author:embest* Desc:DotLed_Test * History:*/*-*/* include files */*-*/#include "fonts.h"
29、;/ - ASCII字模的数据表 - /unsigned char nAsciiDot = / ASCII0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, / - -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x3C,0x3C,0x3C,0x18,0x18, / -!-0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x24,0x00,0x00,0x00, / -"-0x00,0x00,0x00,0x00,0x00
30、,0x00,0x00,0x00,0x00,0x00,0x00,0x6C,0x6C,0xFE,0x6C,0x6C, / -#-0x6C,0xFE,0x6C,0x6C,0x00,0x00,0x00,0x00,0x18,0x18,0x7C,0xC6,0xC2,0xC0,0x7C,0x06, / -$-0x86,0xC6,0x7C,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC2,0xC6,0x0C,0x18, / -%-0x30,0x60,0xC6,0x86,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x6C,0x6C,0
31、x38,0x76,0xDC, / -&-0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x60,0x00,0x00,0x00, / -'-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x18,0x30,0x30,0x30,0x30, / -(-0x30,0x30,0x18,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x18,0x0C,0x0C,0x0C,0x0C, / -)-0x0C,0x0C,0x18
32、,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x66,0x3C,0xFF, / -*-0x3C,0x66,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x7E, / -+-0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, / -,-0x00,0x18,0x18,0x18,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0
33、x00,0x00,0x00,0x00,0xFE, / -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, / -.-0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x06,0x0C,0x18, / -/-0x30,0x60,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0xC6,0xCE,0xD6,0xD6, / -0-0xE6,0xC6,0xC6
34、,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x38,0x78,0x18,0x18,0x18, / -1-0x18,0x18,0x18,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0x06,0x0C,0x18,0x30, / -2-0x60,0xC0,0xC6,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0x06,0x06,0x3C,0x06, / -3-0x06,0x06,0xC6,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0
35、x1C,0x3C,0x6C,0xCC,0xFE, / -4-0x0C,0x0C,0x0C,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xC0,0xC0,0xC0,0xFC,0x0E, / -5-0x06,0x06,0xC6,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x60,0xC0,0xC0,0xFC,0xC6, / -6-0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xC6,0x06,0x06,0x0C,0x18, / -7-0x30,0x30,0x
36、30,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0x7C,0xC6, / -8-0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0x7E,0x06, / -9-0x06,0x06,0x0C,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00, / -:-0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
37、,0x00,0x18,0x18,0x00,0x00, / -;-0x00,0x18,0x18,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x0C,0x18,0x30,0x60, / -<-0x30,0x18,0x0C,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00, / -=-0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x30,0x18,0x0C,0x06, / ->-0x0C
38、,0x18,0x30,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0xC6,0x0C,0x18,0x18, / -?-0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0xC6,0xDE,0xDE, / -0xDE,0xDC,0xC0,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x38,0x6C,0xC6,0xC6,0xFE, / -A-0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00,0x00,0x0
39、0,0xFC,0x66,0x66,0x66,0x7C,0x66, / -B-0x66,0x66,0x66,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x66,0xC2,0xC0,0xC0,0xC0, / -C-0xC0,0xC2,0x66,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x6C,0x66,0x66,0x66,0x66, / -D-0x66,0x66,0x6C,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x66,0x62,0x68,0x78,0x68, / -E-0x60
40、,0x62,0x66,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x66,0x62,0x68,0x78,0x68, / -F-0x60,0x60,0x60,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x66,0xC2,0xC0,0xC0,0xDE, / -G-0xC6,0xC6,0x66,0x3A,0x00,0x00,0x00,0x00,0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xFE,0xC6, / -H-0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00,0x00,0
41、x00,0x3C,0x18,0x18,0x18,0x18,0x18, / -I-0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x0C,0x0C,0x0C,0x0C,0x0C, / -J-0xCC,0xCC,0xCC,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0xE6,0x66,0x6C,0x6C,0x78,0x78, / -K-0x6C,0x66,0x66,0xE6,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x60,0x60,0x60,0x60,0x60, / -L-0x
42、60,0x62,0x66,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0xC6,0xEE,0xFE,0xFE,0xD6,0xC6, / -M-0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00,0x00,0x00,0xC6,0xE6,0xF6,0xFE,0xDE,0xCE, / -N-0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x6C,0xC6,0xC6,0xC6,0xC6, / -O-0xC6,0xC6,0x6C,0x38,0x00,0x00,0x00,0x00,0x00
43、,0x00,0xFC,0x66,0x66,0x66,0x7C,0x60, / -P-0x60,0x60,0x60,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6, / -Q-0xC6,0xD6,0xDE,0x7C,0x0C,0x0E,0x00,0x00,0x00,0x00,0xFC,0x66,0x66,0x66,0x7C,0x6C, / -R-0x66,0x66,0x66,0xE6,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0xC6,0x60,0x38,0x0C, / -S-0x06,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00,0x00
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 办理企业刻章委托书办理实操分享3篇
- 审计招投标失误3篇
- 学校和培训机构合作协议3篇
- 工程劳动协议案例3篇
- 建筑砌块设计大赛作品集考核试卷
- 皮鞋制作设备的选择与维护考核试卷
- 海洋气象与海洋生物地球化学循环考核试卷
- 2025租赁合同协议书范本【下载】
- 2025年标准的公司房屋租赁合同模板
- 2025如何构建医疗服务合同
- 《小学生预防溺水安全教育班会》课件
- 传统园林技艺智慧树知到期末考试答案2024年
- 直播中的礼仪与形象塑造
- 2024年八年级数学下册期中检测卷【含答案】
- 老年人中医健康知识讲座总结
- 海南声茂羊和禽类半自动屠宰场项目环评报告
- 跳绳市场调研报告
- 《民法典》合同编通则及司法解释培训课件
- 《大学生的情绪》课件
- 交通事故法律处理与索赔案例分析与实践指导
- 大学生组织管理能力大赛题库第三届
评论
0/150
提交评论