📄 44bmon.c
字号:
#include <stdlib.h>
#include <string.h>
#include "option.h"
#include "def.h"
#include "44b.h"
#include "44blib.h"
#include "lcd.h"
#include "lcdlib.h"
#include "glib.h"
#include "Bmp_Color256_320_240.h"
#include "Bmp_G16_240_320.h"
volatile char which_int=0;
volatile char p_bmp = 0 ;
extern int Image$$RO$$Limit;
extern int Image$$RW$$Base;
//static int delayLoopCount=400;
void Isr_Init(void);
//***************************************************************************
#define BMP_MAX 6 //此为最大图片数组的个数
void * BMP[] =
{
(unsigned char *)ac1_Ucdragon16 ,
(unsigned char *)acBRUCELEE ,
(unsigned char *)acHEBEN ,
(unsigned char *)acLDH ,
(unsigned char *)acMAO ,
(unsigned char *)acSCHOOL
};
//***************************************************************************
void Key_Handle( unsigned char m )
{
m = (~m)&0x0f ;
//Uart_Printf( "按键处理!键码 = 0x%x\n", m );
switch(m)
{
case 1 : Uart_Printf("KEY1按键被按下了!\n");
Lcd_DispON() ;
break ;
case 2 : Uart_Printf("KEY2按键被按下了!\n");
Lcd_DispOFF() ;
break ;
case 4 : Uart_Printf("KEY3按键被按下了!\n");
if( p_bmp==BMP_MAX ) p_bmp = 0 ;
LcdG16_Bmp_Overturn( BMP[p_bmp] ) ;
//LcdG16_Bmp( BMP[p_bmp] ) ;
p_bmp++ ;
break ;
case 8 : Uart_Printf("KEY4按键被按下了!\n");
if( p_bmp==BMP_MAX ) p_bmp = 0 ;
LcdG16_Bmp_Overturn( BMP[p_bmp] ) ;
//LcdG16_Bmp( BMP[p_bmp] ) ;
if( p_bmp==0 ) p_bmp = BMP_MAX ;
p_bmp-- ;
break ;
default : break ;
}
}
//***************************************************************************
//***************************************************************************
void Main(void)
{
rSYSCFG = CACHECFG;
//8K字节cache,写缓冲使能,data abort使能
rNCACHBE0 = ((Non_Cache_End>>12)<<16)|(Non_Cache_Start>>12);
//在上面的数据区域不使用高速缓存
Port_Init();
//ChangePllValue( 56, 2, 1 ); //晶振8MHz,修改系统主频为8倍频(64MHz)
//ChangePllValue( 56, 3, 1 ); //晶振10MHz,修改系统主频为6.4倍频(64MHz)
ChangePllValue( 24, 3, 1 ); //晶振10MHz,修改系统主频为3.2倍频(32MHz)
Led_Display(0x00);
Delay(500);
Led_Display(0x07);
Delay(500);
Led_Display(0x0);
Uart_Init(0,115200);
Delay(1000);
Uart_Select(0); //Select UART0
/*******************************/
/* Banner */
/*******************************/
Uart_Printf("\n\n*************************************************************************");
Uart_Printf("\n uuuuuuu uuuuuu uu uu uuuuuu uuu uuuu uuuu ");
Uart_Printf("\n uu uu uu uu uuu uuu uu uu uu uu uu uu ");
Uart_Printf("\n uu uu uu uu uuuu uuuu uu uu uu uu uu uu ");
Uart_Printf("\n uu uu uu uu uu uu uu uu uu uu uu uu uu ");
Uart_Printf("\n uuuuu uu uu uu uu uu uuuuu uu uu uuu ");
Uart_Printf("\n uu uu uuu uu uu uu uu uu uu uu uu uuu ");
Uart_Printf("\n uu uu uu uu uu uu uu uu uu uu uu uuu ");
Uart_Printf("\n uu uu uuuuuuu uuuuuuu uu uu uu uu uu uu ");
Uart_Printf("\n uu uu uu uu uu uu uu uu uu uu uu ");
Uart_Printf("\n uu uu uu uu uu uu uu uu uu uu uu ");
Uart_Printf("\n uuuu uuuuuu uuuuu uuuuu uuuuuu uuu uuuu uuuu \n");
Uart_Printf("\n* lcd_demo for FS44B0X ARM DEVELOPER BOARD V1.01");
Uart_Printf("\n* http://www.uCdragon.com");
Uart_Printf("\n* Date: 2003-11-30 15:18 Change By GongJun");
Uart_Printf("\n* MCLK=%dMHz",MCLK/1000000);
Uart_Printf("\n* COM:115.2kbps,8Bit,NP,UART0");
Uart_Printf("\n* RO_Limit=0x%8x",Image$$RO$$Limit);
Uart_Printf("\n* RW_BASE =0x%8x",Image$$RW$$Base);
Uart_Printf("\n*************************************************************************\n\n");
Lcd_DispON(); //开启LCD显示
LcdG16_Bmp_Overturn( ac1_Ucdragon16 ) ; //在LCD上面显示优龙科技画面
//LcdG16_Bmp( ac1_Ucdragon16 ) ; //在LCD上面显示优龙科技画面
Uart_Printf("*************************************************************************\n");
Uart_Printf("\tSTN 16色液晶屏(尺寸为240×320)测试程序\n") ;
Uart_Printf("\t下面请按电路板上面的按键进行测试 : \n") ;
Uart_Printf("\t按键1(KEY1)功能为开启LCD显示 ;\n") ;
Uart_Printf("\t按键2(KEY2)功能为关闭LCD显示 ;\n") ;
Uart_Printf("\t按键3(KEY3)功能为LCD显示显示的画面向后翻页 ;\n") ;
Uart_Printf("\t按键4(KEY4)功能为LCD显示显示的画面向前翻页 ;\n") ;
Uart_Printf("*************************************************************************\n\n");
rPCONG = 0x0000; //PG口作为输入口
while(1)
{
if( (rPDATG&0xf0) != 0xf0 ) //有键按下
{
Delay(20) ; //延时再检测
if( (rPDATG&0xf0) != 0xf0) //有键按下
{
Uart_Printf( "确认按键按下!rPDATG = 0x%x\n", rPDATG );
Key_Handle( (rPDATG>>4)&0x0f ) ; //键盘处理
while( (rPDATG&0xf0) != 0xf0 ) ; //键一直按下则等待
}
}
}
}
//*****************************************************************************
int pIrqStart = 0;
int pIrqHandler = 0;
int pIrqFinish = 0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -