main.c
来自「这是我学习过程中编写的测试代码」· C语言 代码 · 共 68 行
C
68 行
#include <string.h>
#include <stdio.h>
#include "inc\def.h"
#include "inc\44b.h"
#include "inc\44blib.h"
void keyinit()
{
rEXTINT=0x22222222;//下降沿触发
/* EINT7 EINT6 EINT5 EINT4 EINT3 EINT2 EINT1 EINT0*/
/* 0010 0010 0010 0010 0010 0010 0010 0010 */
/* 0000-低电平触发;0001-高电平触发;001X-下降沿触发*/
/* 010X-上升沿触发;011X-边沿触发 */
rINTCON=0x5;//禁止IRQ的“矢量中断模式”,使能CPU响应IRQ中断的请求,禁止CPU响应FIR中断的请求。
pISR_EINT0=(unsigned)keyboard;//修改中断处理函数指针
rINTMOD=0x0; // 均为IRQ模式
rINTMSK =~(BIT_GLOBAL|BIT_EINT0); //开启中断
}
void Main()
{
*((U32 *)PLLCON) = 0x48032; //set clock to be 40M
Port_Init();
keyinit();
Uart_Init(0,115200);
LcdInit();
Led_Display(0xf);
Uart_Printf("\n\n*************************************************************************");
Uart_Printf("\n* 南京师范大学 *");
Uart_Printf("\n* -S3C44B0X功能部件:I/O测试- *");
Uart_Printf("\n* Version 1.0 *");
Uart_Printf("\n* Email:xianyun.wang@gmail.com *");
Uart_Printf("\n* UART Config--COM:115.2kbps,8Bit,NP,UART0 *");
Uart_Printf("\n*--------------------------开始测试 -------------------------------------*");
Led_Display(0x0);
Uart_Printf("\n* 图片显示测试 *");
displaylcd();
Uart_Printf("\n* 任意键继续 *");
while(Uart_GetIntNum());
clrscreen();
Uart_Printf("\n* 画填充矩形测试 *");
lcddrawbox(20,20,85,96);
Uart_Printf("\n* 任意键继续 *");
while(Uart_GetIntNum());
clrscreen();
Uart_Printf("\n* 单线画矩形测试 *");
Lcd_Line(0,0,100,0);
Lcd_Line(0,0,0,100);
Lcd_Line(100,0,0,100);
Lcd_Line(0,100,100,0);
Lcd_Line(0,0,100,100);
Lcd_Line(100,0,0,100);
Uart_Printf("\n* 任意键继续 *");
while(Uart_GetIntNum());
clrscreen();
Uart_Printf("\n* 画圆曲线测试 *");
Lcd_cicle(60,80,60,3);
Uart_Printf("\n* 任意键继续 *");
while(Uart_GetIntNum());
Uart_Printf("\n* 任意汉字、字母显示测试 *");
printchar(0,0,"hello!The LCD is OK!",0);
printchar(50,4,"任何一个微处理器都要与一定数量的部件和外围设备连接 ",0);
Uart_Printf("\n* 请按小键盘,键值在数码管显示 *");
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?