main.c

来自「基于三星44b0万龙开发板使用的LCD(JG12864M)的显示屏驱动程序」· C语言 代码 · 共 111 行

C
111
字号
#include "option.h"
#include "def.h"
#include "44b.h"
#include "44blib.h"

void Isr_Init(void);
void HaltUndef(void);
void HaltSwi(void);
void HaltPabort(void);      
void HaltDabort(void);

void Main(void)
{

    rSYSCFG=SYSCFG_8KB;

#if (PLLON==1)
    ChangePllValue(PLL_M,PLL_P,PLL_S);
#endif

    Isr_Init();
    Port_Init();
    Uart_Init(0,115200);
    Uart_Select(0);
    Delay(0);  //calibrate Delay()
    Led_Display(7);
    Delay(1000);  //calibrate Delay()
    Led_Display(0);
    Delay(5000);  //calibrate Delay()
    Led_Display(7);
    Uart_Printf("\n start \n");
    
rPDATC&=~0x10;
LCDIni();
    
TextDisplayInit();
DelayNS(1);

//IO0DIR|=LCDLIGHT;
//IO0SET|=LCDLIGHT;
clearpicture();//图片显示
DelayNS(1);
displaypicture( );

graphshow();

DelayNS(10);
TextDisplayInit();
printsentence(0,"欢迎使用简易ARM7");//xdenotes the start line  the 12864module is 4 line and 8 column
printsentence(1,"arm44b0-实验平台");
printsentence(2,"嵌入式系统网出品");
printsentence(3,"www.myarm.net   ");


Blink(2);//此函数用来测试反白效果


while(1){
	    Delay(5000);  //calibrate Delay()
	    Led_Display(1);
	    Delay(5000);  //calibrate Delay()
	    Led_Display(2);
	    Delay(5000);  //calibrate Delay()
	    Led_Display(4);

}
}
void Isr_Init(void)
{
    U32 i;
    
    pISR_UNDEF=(unsigned)HaltUndef;
    pISR_SWI  =(unsigned)HaltSwi;
    pISR_PABORT=(unsigned)HaltPabort;
    pISR_DABORT=(unsigned)HaltDabort;
    
     for(i=_RAM_STARTADDRESS;i<(_RAM_STARTADDRESS+0x20);i+=4)
    {
	*((volatile unsigned *)i)=0xEA000000+0x1FFE;
    }

    rINTCON=0x5;	  // Non-vectored,IRQ enable,FIQ disable    

    rINTMOD=0x0;	  // All=IRQ mode
    rINTMSK|=BIT_GLOBAL|BIT_EINT3;	  // All interrupt is masked.
}


void HaltUndef(void)
{
    Uart_Printf("Undefined instruction exception!!!\n");
    while(1);
}

void HaltSwi(void)
{
    Uart_Printf("SWI exception!!!\n");
    while(1);
}

void HaltPabort(void)
{
    Uart_Printf("Pabort exception!!!\n");
    while(1);
}

void HaltDabort(void)
{
    Uart_Printf("Dabort exception!!!\n");
    while(1);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?