www.pudn.com > EBDSAM7S64-Basic-ADS.rar > main.c


//*-------------------------------------------------------------------------------------- 
//*      ATMEL Microcontroller Software Support  -  ROUSSET  - 
//*-------------------------------------------------------------------------------------- 
//* The software is delivered "AS IS" without warranty or condition of any 
//* kind, either express, implied or statutory. This includes without 
//* limitation any warranty or condition with respect to merchantability or 
//* fitness for any particular purpose, or against the infringements of 
//* intellectual property rights of others. 
//*-------------------------------------------------------------------------------------- 
//* File Name           : Boot_loader main file 
//* Object              : 
//* Translator          : 
//* 1.0 19/03/01 HI	: Creation 
//* 1.1 02/10/02 FB	: Add on Svc DataFlash 
//* 1.2 13/Sep/04 JPP	: Add DBGU 
//* 1.3 16/Dec/04 JPP	: Add USART and enable reset 
//*-------------------------------------------------------------------------------------- 
 
#include "board.h" 
 
extern void		AT91F_DBGU_Printk(char *); 
extern char		AT91F_DBGU_getc(void); 
extern void		uprintf(char *fmt,...); 
 
//*-------------------------------------------------------------------------------------- 
//* Function Name       : delay 
//* Object              : Software delay loop 
//* Input Parameters    : none. Waiting time 
//* Output Parameters   : none 
//*-------------------------------------------------------------------------------------- 
void delay(unsigned int x) 
{//* Begin 
	unsigned int i; 
	while(--x) 
	{ 
		for(i=0;i<5000;i++); 
	} 
}//* End 
 
//*-------------------------------------------------------------------------------------- 
//* Function Name       : main 
//* Object              : 
//*-------------------------------------------------------------------------------------- 
int main ( void ) 
{ 
	unsigned char	caractere; 
	unsigned int tick=8019; 
     
	AT91F_DBGU_Printk("\n\r================================================"); 
	AT91F_DBGU_Printk("\n\r==         欢迎使用英贝德公司的产品           =="); 
	AT91F_DBGU_Printk("\n\r==         EBD7S64 各种中断的演示测试         =="); 
	AT91F_DBGU_Printk("\n\r==   更多的的帮助请到 http://www.szembed.com  ==");		 
	AT91F_DBGU_Printk("\n\r================================================\n\r"); 
 
	while (1) { 
		caractere = AT91F_DBGU_getc(); 
		switch(caractere) 
		{ 
			case '\r': 
			 
				uprintf("\n\r%d\n\r",tick);	 
				break;				 
				 
			case '-': 
				uprintf("\n\r%d\n\r",--tick); 
				break;				 
			case '+':								 
				uprintf("\n\r%d\n\r",++tick); 
				break;				 
			case 'Y':			 
			case 'y':	 
				uprintf("\n\rhello world\n\r");				 
				break;			 
			default: 
				AT91F_DBGU_Printk("\n\rBad choice, Retry please\n\r"); 
				break; 
		}	 
	 
	} 
 
	while (1) { 
		AT91F_DBGU_Printk("."); 
		delay(2000); 
	} 
 
/* 
	tick = *(AT91C_ST_CRTR); 
	while (1) { 
		AT91F_DBGU_Printk("."); 
		 
		while (tick == *(AT91C_ST_CRTR)); 
		tick = *(AT91C_ST_CRTR); 
	} 
*/ 
}