为了正常的体验网站,请在浏览器设置里面开启Javascript功能!

嵌入式LED灯显示

2018-01-07 39页 doc 160KB 71阅读

用户头像

is_212655

暂无简介

举报
嵌入式LED灯显示嵌入式LED灯显示 【设计题目】 矩阵LED字符显示控制系统设计 【设计目的】 1(掌握无操作系统下的硬件软件设计原理和方法, 2(进一步熟悉ARM 处理器的基本结构、指令集、存储系统以及基本接口编程, 3(熟悉嵌入式系统各部件的硬件初始化过程以及基本IO控制方法。 4(掌握矩阵LED 的应用原理 【设计内容】 1(利用sys_init初始化程序~利用串口实现PC和开发板的数据通信, 2(编写S3C2410X 处理器的点阵屏驱动程序, 3(编写S3C2410X 处理器的点阵屏应用程序。 4. 当程序运行等待要...
嵌入式LED灯显示
嵌入式LED灯显示 【设计题目】 矩阵LED字符显示控制系统设计 【设计目的】 1(掌握无操作系统下的硬件软件设计原理和方法, 2(进一步熟悉ARM 处理器的基本结构、指令集、存储系统以及基本接口编程, 3(熟悉嵌入式系统各部件的硬件初始化过程以及基本IO控制方法。 4(掌握矩阵LED 的应用原理 【设计内容】 1(利用sys_init初始化程序~利用串口实现PC和开发板的数据通信, 2(编写S3C2410X 处理器的点阵屏驱动程序, 3(编写S3C2410X 处理器的点阵屏应用程序。 4. 当程序运行等待从串口输入学生姓名的字符串在矩阵LED上显示出来。 【实验环境】 硬件:Embest EduKit-IV 平台~ULINK2 仿真器套件~PC 机, 软件:μVision IDE for ARM 集成开发环境~Windows XP。 【相关知识综述】 背景知识、原理算法等 一、硬件部分 1(点阵屏的结构电路 图1点阵屏的结构电路 图上QL1-QL16为行驱动信号,每个信号控制一行, LR1,LR16 是点阵屏的列驱动信号, 2014-2015学年第1学期嵌入式操作系统课程设计报告 每一个信号控制一列。当行信号为高电平而列信号为低电平,对应的LED就会亮。 2,S3C2410与点阵屏的连接 RSTR STROBE GPB4 CD4094 LL1 DATA GPC0 CLK GPD1 0 LOE GPB5 1#芯片 LL7 LQS LL8 GPG8 LSTR STROBE CD4094 LL9 列锁存信DATA 号 CLK LOE LL15 2#芯片 LL16 图2 S3C2410ARM处理器与两片CD4094连接得到16位行选信号图 以上电路可以通过S3C2410GPIO口把CPU的并行数据(16位两个字节的数据)打入到两个CD4094芯片中并锁存起来变成LL1-LL16的行选信号。 各信号的作用如下表1; 2410引脚 电平各信号的作用 CD4094 信号 高低 高 行锁存允许,将串行数据大入到CD4094相应位 STORBE GPB4 (RSTR) 低 不锁存 高 CD4094 上锁存的并行数据全部输出(输出使能) GPB5 LOE 低 CD4094 上锁存的并行数据不输出 高 CD4094 允许串行输入的数据发生变化 GPD10 CLK 低 CD4094 不允许串行输入的数据发生变化 高 表明串行数据为1 GPC0 DATA 低 表明串行数据为0 高 列锁存允许,将串行数据大入到CD4094相应位 STORBE GPG8 低 不锁存 LSTR 3(点阵屏的保护电路 1 2014-2015学年第1学期嵌入式操作系统课程设计报告 图3 点阵屏的保护电路图 为了保护LED屏加了对应的电阻实现行限流作用,即LL1-LL16变为RQ1-RQ16 4(LED的驱动 加入行驱动电路的目的是实现LED灯的驱动。这样由RQ1-RQ16变为行驱动信号 QL1-QL16。Q11-QL16为图1中的行驱动信号。 图4 行驱动电路 【设计思路】 采用的数据结构、主要的函数说明、程序流程设计图等 主要的函数说明: led_init(); :LED显示矩阵初始化 static void refresh_l_display_array(u8 bits, u8 *str) :显示字符 void led_logo_disp(void) :显示logo struct fonts_struct { unsigned char ascii_width; unsigned char ascii_height; unsigned char * ascii_code; unsigned char ascii_beg; unsigned char ascii_end; }; 2 2014-2015学年第1学期嵌入式操作系统课程设计报告 【源程序清单】 /********************************************************************************************* * 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" 3 2014-2015学年第1学期嵌入式操作系统课程设计报告 /****************************************************************************** *************** * name: main * func: c code entry * para: none * ret: none * modify: * comment: ******************************************************************************* **************/ int main(void) { char c; sys_init(); // Initial system while(1) { uart_printf("\n Please Look At The 16X16 LEDS And Choose Key\n"); uart_printf("1、向左移动\n"); uart_printf("2、向左闪烁移动\n"); uart_printf("3、向右移动\n"); uart_printf("4、向右闪烁移动\n"); c=uart_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,"^_^学号"); right_out(0,"abcdef"); } else if(c=='4') 4 2014-2015学年第1学期嵌入式操作系统课程设计报告 { r_flash_char_out(0,"^_^学号"); right_out_flash(0,"abcdef"); } } } /********************************************************************************************* * File: Dotled.c * Author: embest * Desc: DotLed_Test * History: *********************************************************************************************/ /*------------------------------------------------------------------------------------------*/ /* include files */ /*------------------------------------------------------------------------------------------*/ #include #include "2410lib.h" #include "fonts.h" #include "led16x16.h" /*------------------------------------------------------------------------------------------*/ /* function declare */ /*------------------------------------------------------------------------------------------*/ extern void led_char_disp(void); /*------------------------------------------------------------------------------------------*/ /* global variables */ /*------------------------------------------------------------------------------------------*/ u8 l_display_array[2*16]; u8 assic_buffer[3*16]; /*============================================================================================ l_display_array: +-----+-----+ | | | | D | E | 5 2014-2015学年第1学期嵌入式操作系统课程设计报告 | | | +-----+-----+ A buffer data and B buffer data -->D buffer data B buffer data and C buffer data -->E buffer data assic_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 led_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: ******************************************************************************* **************/ 6 2014-2015学年第1学期嵌入式操作系统课程设计报告 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_array[2*i] = (*str<>remaining_bits); l_display_array[2*(i+1)-1] = (*(str+16)<>remaining_bits); str++; } } static void refresh_flash_display_array(u8 bits, u8 *str) { u32 i; for(i=0;i<16;i++) { l_display_array[2*i] = 0; l_display_array[2*(i+1)-1] =0; str++; } } /****************************************************************************** *************** * name: l_display_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(); } } 7 2014-2015学年第1学期嵌入式操作系统课程设计报告 static void l_flash_display_scroll ( u8 *str ) { int i; for(i=0;i<8;i++) { refresh_l_display_array(i, 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_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: 8 2014-2015学年第1学期嵌入式操作系统课程设计报告 * comment: ******************************************************************************* **************/ static void copy_data(u8 *dst, u8 *src, u32 size) { while(size--) *(dst++) = *(src++); } /****************************************************************************** *************** * name: refresh_assic_buffer * func: refresh buffer * para: str:points the new char * ret: none * modify: * comment: ******************************************************************************* **************/ static void l_refresh_assic_buffer(u8 *str) { copy_data(&assic_buffer[0], &assic_buffer[16],16); copy_data(&assic_buffer[16], &assic_buffer[32],16); copy_data(&assic_buffer[32], str,16); l_display_scroll(assic_buffer); } static void l_flash_refresh_assic_buffer(u8 *str) { copy_data(&assic_buffer[0], &assic_buffer[16],16); copy_data(&assic_buffer[16], &assic_buffer[32],16); copy_data(&assic_buffer[32], str,16); l_flash_display_scroll(assic_buffer); } static void r_refresh_assic_buffer(u8 *str) { copy_data(&assic_buffer[32], &assic_buffer[16],16); copy_data(&assic_buffer[16], &assic_buffer[0],16); copy_data(&assic_buffer[0], str,16); r_display_scroll(assic_buffer); } 9 2014-2015学年第1学期嵌入式操作系统课程设计报告 static void r_flash_refresh_assic_buffer(u8 *str) { copy_data(&assic_buffer[32], &assic_buffer[16],16); copy_data(&assic_buffer[16], &assic_buffer[0],16); copy_data(&assic_buffer[0], 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 = fonts[font].ascii_code + ( glyph - fonts[font].ascii_beg) * fonts[font].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' ) { 10 2014-2015学年第1学期嵌入式操作系统课程设计报告 str_ptr = fonts[font].ascii_code + ( glyph - fonts[font].ascii_beg) * fonts[font].ascii_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 = fonts[font].ascii_code + ( glyph - fonts[font].ascii_beg) * fonts[font].ascii_height; r_refresh_assic_buffer(str_ptr); str++; 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 = fonts[font].ascii_code + ( glyph - fonts[font].ascii_beg) * fonts[font].ascii_height; r_flash_refresh_assic_buffer(str_ptr); str++; glyph = ( u8 )*str; } } void left_out(u8 font, u8 *str) { u8 *str_ptr; u8 glyph; glyph = ( u8 )*str; while(glyph != '\0' ) { 11 2014-2015学年第1学期嵌入式操作系统课程设计报告 str_ptr = leftcode[font].ascii_code + ( glyph - leftcode[font].ascii_beg) * leftcode[font].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 = ( u8 )*str; while(glyph != '\0' ) { str_ptr = leftcode[font].ascii_code + ( glyph - leftcode[font].ascii_beg) * leftcode[font].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_ptr = rightcode[font].ascii_code + ( glyph - rightcode[font].ascii_beg) * rightcode[font].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' ) { 12 2014-2015学年第1学期嵌入式操作系统课程设计报告 str_ptr = rightcode[font].ascii_code + ( glyph - rightcode[font].ascii_beg) * rightcode[font].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:Output rGPCCON = rGPCCON & 0xffff3ffc | 0x4001; // GPC0,GPC7=01:Output rGPDCON = rGPDCON & 0xffcfffff | 0x100000; // GPD10=01:Output rGPGCON = rGPGCON & 0xfffcffff | 0x10000; // GPG8=01:Output } /********************************************************************************************* * File: fonts.c * Author: embest * Desc: DotLed_Test * History: *********************************************************************************************/ /*------------------------------------------------------------------------------------------*/ /* include files */ /*------------------------------------------------------------------------------------------*/ #include "fonts.h" // ------------------ ASCII字模的数据表 ------------------------ // unsigned char nAsciiDot[] = // ASCII { 13 2014-2015学年第1学期嵌入式操作系统课程设计报告 0x00,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,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,0x38,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,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,0x00,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, 14 2014-2015学年第1学期嵌入式操作系统课程设计报告 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,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,0x1C,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,0x30,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,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, // -=- 15 2014-2015学年第1学期嵌入式操作系统课程设计报告 0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x60,0x30,0x18,0x0C,0x06, // ->- 0x0C,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,0x00,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,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,0x00,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, 16 2014-2015学年第1学期嵌入式操作系统课程设计报告 0x00,0x00,0xF0,0x60,0x60,0x60,0x60,0x60, // -L- 0x60,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,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,0x00,0x7E,0x7E,0x5A,0x18,0x18,0x18, // -T- 0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, 0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6, // -U- 0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, 0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6, // -V- 0xC6,0x6C,0x38,0x10,0x00,0x00,0x00,0x00, 0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xD6, // -W- 0xD6,0xFE,0x6C,0x6C,0x00,0x00,0x00,0x00, 0x00,0x00,0xC6,0xC6,0x6C,0x6C,0x38,0x38, // -X- 0x6C,0x6C,0xC6,0xC6,0x00,0x00,0x00,0x00, 0x00,0x00,0x66,0x66,0x66,0x66,0x3C,0x18, // -Y- 0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, 0x00,0x00,0xFE,0xC6,0x86,0x0C,0x18,0x30, // -Z- 0x60,0xC2,0xC6,0xFE,0x00,0x00,0x00,0x00, 17 2014-2015学年第1学期嵌入式操作系统课程设计报告 0x00,0x00,0x3C,0x30,0x30,0x30,0x30,0x30, // -[- 0x30,0x30,0x30,0x3C,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x80,0xC0,0xE0,0x70,0x38, // -\- 0x1C,0x0E,0x06,0x02,0x00,0x00,0x00,0x00, 0x00,0x00,0x3C,0x0C,0x0C,0x0C,0x0C,0x0C, // -]- 0x0C,0x0C,0x0C,0x3C,0x00,0x00,0x00,0x00, 0x10,0x38,0x6C,0xC6,0x00,0x00,0x00,0x00, // -^- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // -_- 0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00, 0x30,0x30,0x18,0x00,0x00,0x00,0x00,0x00, // -`- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x78,0x0C,0x7C, // -a- 0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, 0x00,0x00,0xE0,0x60,0x60,0x78,0x6C,0x66, // -b- 0x66,0x66,0x66,0xDC,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0xC0, // -c- 0xC0,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00, 0x00,0x00,0x1C,0x0C,0x0C,0x3C,0x6C,0xCC, // -d- 0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0xFE, // -e- 0xC0,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00, 0x00,0x00,0x38,0x6C,0x64,0x60,0xF0,0x60, // -f- 0x60,0x60,0x60,0xF0,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x76,0xCC,0xCC, // -g- 0xCC,0xCC,0xCC,0x7C,0x0C,0xCC,0x78,0x00, 0x00,0x00,0xE0,0x60,0x60,0x6C,0x76,0x66, // -h- 0x66,0x66,0x66,0xE6,0x00,0x00,0x00,0x00, 0x00,0x00,0x18,0x18,0x00,0x38,0x18,0x18, // -i- 18 2014-2015学年第1学期嵌入式操作系统课程设计报告 0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, 0x00,0x00,0x06,0x06,0x00,0x0E,0x06,0x06, // -j- 0x06,0x06,0x06,0x06,0x66,0x66,0x3C,0x00, 0x00,0x00,0xE0,0x60,0x60,0x66,0x6C,0x78, // -k- 0x78,0x6C,0x66,0xE6,0x00,0x00,0x00,0x00, 0x00,0x00,0x38,0x18,0x18,0x18,0x18,0x18, // -l- 0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0xEC,0xFE,0xD6, // -m- 0xD6,0xD6,0xD6,0xD6,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0xDC,0x66,0x66, // -n- 0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0xC6, // -o- 0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0xDC,0x66,0x66, // -p- 0x66,0x66,0x66,0x7C,0x60,0x60,0xF0,0x00, 0x00,0x00,0x00,0x00,0x00,0x76,0xCC,0xCC, // -q- 0xCC,0xCC,0xCC,0x7C,0x0C,0x0C,0x1E,0x00, 0x00,0x00,0x00,0x00,0x00,0xDC,0x76,0x62, // -r- 0x60,0x60,0x60,0xF0,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0x60, // -s- 0x38,0x0C,0xC6,0x7C,0x00,0x00,0x00,0x00, 0x00,0x00,0x10,0x30,0x30,0xFC,0x30,0x30, // -t- 0x30,0x30,0x36,0x1C,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0xCC,0xCC,0xCC, // -u- 0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66, // -v- 0x66,0x66,0x3C,0x18,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0xC6,0xC6,0xC6, // -w- 0xD6,0xD6,0xFE,0x6C,0x00,0x00,0x00,0x00, 19 2014-2015学年第1学期嵌入式操作系统课程设计报告 0x00,0x00,0x00,0x00,0x00,0xC6,0x6C,0x38, // -x- 0x38,0x38,0x6C,0xC6,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0xC6,0xC6,0xC6, // -y- 0xC6,0xC6,0xC6,0x7E,0x06,0x0C,0xF8,0x00, 0x00,0x00,0x00,0x00,0x00,0xFE,0xCC,0x18, // -z- 0x30,0x60,0xC6,0xFE,0x00,0x00,0x00,0x00, 0x00,0x00,0x0E,0x18,0x18,0x18,0x70,0x18, // -{- 0x18,0x18,0x18,0x0E,0x00,0x00,0x00,0x00, 0x00,0x00,0x18,0x18,0x18,0x18,0x00,0x18, // -|- 0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00, 0x00,0x00,0x70,0x18,0x18,0x18,0x0E,0x18, // -}- 0x18,0x18,0x18,0x70,0x00,0x00,0x00,0x00, 0x00,0x00,0x76,0xDC,0x00,0x00,0x00,0x00, // -~- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, }; unsigned char left[] = // ASCII,左移 { 字模软件提取即可 }; unsigned char right[] ={ 字模软件提取即可 }; struct fonts_struct fonts[FONT_COUNT] = { {8,16,nAsciiDot,' ','~'}, }; struct fonts_struct leftcode[FONT_COUNT] = { {8,16,left,'a','~'}, }; struct fonts_struct rightcode[FONT_COUNT] = { {8,16,right,'a','~'}, }; 20 2014-2015学年第1学期嵌入式操作系统课程设计报告 /********************************************************************************************* * File: Dotled.c * Author: embest * Desc: DotLed_Test * History: *********************************************************************************************/ /*------------------------------------------------------------------------------------------*/ /* include files */ /*------------------------------------------------------------------------------------------*/ #include "2410lib.h" #include "ziku.h" #include "fonts.h" #include "led16x16.h" /*------------------------------------------------------------------------------------------*/ /* constant define */ /*------------------------------------------------------------------------------------------*/ #define En_Dataout rGPBDAT |= 0x20 #define DisEn_Dataout rGPBDAT &= 0xFFDF #define CLK_H rGPDDAT |= 0x400 #define CLK_L rGPDDAT &= 0xFBFF #define Rdata_H rGPCDAT |= 0x1 #define Rdata_L rGPCDAT &= 0xFFFE #define Ldata_H rGPCDAT |= 0x1 #define Ldata_L rGPCDAT &= 0xFFFE #define Lstr_H rGPBDAT |= 0x10 #define Lstr_L rGPBDAT &= 0xFFEF #define Rstr_H rGPGDAT |= 0x100 #define Rstr_L rGPGDAT &= 0xFEFF /*------------------------------------------------------------------------------------------*/ /* global variables */ /*------------------------------------------------------------------------------------------*/ 21 2014-2015学年第1学期嵌入式操作系统课程设计报告 INT8T cTemp; INT8T cEnChange0,cEnChange1; UINT8T dispram[32]; /****************************************************************************** *************** * name: write_L4094 * func: write list data * para: none * ret: none * modify: * comment: ******************************************************************************* **************/ void write_L4094(UINT16T data) { UINT8T i; Lstr_H; for(i=0;i<16;i++) { CLK_L; if(data & 0x01==1) Ldata_H; else Ldata_L; data = data >> 1; CLK_H; } Lstr_L; } /****************************************************************************** *************** * name: write_R4094 * func: write row data * para: none * ret: none * modify: * comment: ******************************************************************************* **************/ void write_R4094(UINT8T data) { UINT8T i; 22 2014-2015学年第1学期嵌入式操作系统课程设计报告 Rstr_H; for(i = 0; i < 8; i++) { CLK_L; if(data & 0x01==1) Rdata_H; else Rdata_L; data = data >> 1; CLK_H; } Rstr_L; } /****************************************************************************** *************** * name: led_char_disp * func: led char display * para: none * ret: none * modify: * comment: ******************************************************************************* **************/ void led_char_disp(void) { UINT8T i=0; UINT8T j=2,k=0; UINT16T x; for(i = 0; i < 32; i++) dispram[i] = ~l_display_array[i]; i=0; while(i < 16) { Rstr_L; // Enable RSTR Lstr_L; // Enable LSTR DisEn_Dataout; // lock the data do { // Write the row data j--; write_R4094(dispram[i * 2 + j]); }while(j); 23 2014-2015学年第1学期嵌入式操作系统课程设计报告 x=~(0x8000 >> i); // Write one list data write_L4094(x); En_Dataout; // Output the data for(k = 0;k < 250; k++); i++; j = 2; } } 【设计总结】 通过这次嵌入式课程设计,我对嵌入式有了更深一层的理解。通过这次课程设计初步掌握了无操作系统下的硬件软件设计原理和方法;熟悉了ARM 处理器的基本结构、指令集、存储系统以及基本接口编程;熟悉了嵌入式系统各部件的硬件初始化过程以及基本IO控制方法。掌握了矩阵LED 的应用原理。 24
/
本文档为【嵌入式LED灯显示】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。 本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。 网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。

历史搜索

    清空历史搜索