leddemo.c

来自「ARM9-2410的LED灯点亮码源」· C语言 代码 · 共 56 行

C
56
字号
#include "2410library.h"
#include "interrupt.h"
#include <stdlib.h>
#include "def.h"

U8 test[6] = {0,1,2,3,4,5};  //Seg7
int NumInt = 0;

void  __irq Irq_Handle(void);

void  __irq Irq_Handle(void)
{	
	NumInt = NumInt + 1;
	Seg7_Display(0x3f,test);
	Uart_SendString("this is interrupt handler! \n");
	Uart_Printf("the times of interrupt is %d \n",NumInt);
	Irq_Clear(IRQ_EINT3);
}

int Main()
{    
	
	ChangeClockDivider(1,1);
	ChangeMPllValue(0xa1,0x3,0x1);
	
	//serial related operation
	Uart_Init(0,115200);
	Uart_Select(0);	
	
	Uart_Printf("\n ----UART 测试信号----- \n");
	
	//interrupt related operation	
	Isr_Init();
	Port_Init();
	Irq_Request(IRQ_EINT3,(void *)Irq_Handle);
	Irq_Enable(IRQ_EINT3);
	
	//check circuit operation	
	Led_Display(0x0);
	Delay(100);
	Led_Display(0xf);
	Delay(100);
	Seg7_Display(0x3f,test);	
	

	while(1)
	{
	
		Seg7_Display(0x0f,test);
					 
	}	 
	return 0;
}


⌨️ 快捷键说明

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