⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 EMB91SAM7S64开发板(全套资料)
💻 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           : main.c
//* Object              : main application written in C
//* 1.0 24/Jun/04 JPP   : Creation
//*
//*----------------------------------------------------------------------------

// Include Standard LIB  files
#include "CAN.h"
#include "Board.h"
#include "dbgu.h"

void blink(unsigned int vLED)
{
    if ( (AT91F_PIO_GetInput(AT91C_BASE_PIOA) & vLED ) == vLED )
    {
        AT91F_PIO_ClearOutput( AT91C_BASE_PIOA, vLED );
    }
    else
    {
        AT91F_PIO_SetOutput( AT91C_BASE_PIOA, vLED );
    }
} 
//*----------------------------------------------------------------------------
//* \fn    AT91F_DBGU_getc
//* \brief This function is used to receive a character to the DBGU channel
//*----------------------------------------------------------------------------
char AT91F_DBGU_getc(void)
{
	while (!AT91F_US_RxReady((AT91PS_USART)AT91C_BASE_DBGU));
	return AT91F_US_GetChar((AT91PS_USART) AT91C_BASE_DBGU);
}
//*----------------------------------------------------------------------------
//* Function Name       : main
//* Object              : Main interrupt function
//*		level timer 0 => 1
//*	SW2	level Irq0    => 2
//*		level timer 1 => 4
//*	SW4	level PIOA    => 6
//*		level USART   => 7
//*		LEVEL FIQ     => MAX
//* Input Parameters    : none
//* Output Parameters   : TRUE
//*----------------------------------------------------------------------------
int main( void )
{
//* Begin

		unsigned char	caractere;       
        AT91F_DBGU_Init(); 
 		AT91F_DBGU_Printk("\n\r================================================");       
		AT91F_DBGU_Printk("\n\r==         欢迎使用英贝德公司的产品           ==");
		AT91F_DBGU_Printk("\n\r==    EBDSAM7S64 CAN总线测试(SPI口MCP2510)    ==");	
		AT91F_DBGU_Printk("\n\r==   更多的的帮助请到 http://www.szembed.com  =="); 
		AT91F_DBGU_Printk("\n\r================================================\n\r");		
                     
	//* Init
//     	loop_count = 0 ;
    	// First, enable the clock of the PIOB
    	AT91F_PMC_EnablePeriphClock ( AT91C_BASE_PMC, 1 << AT91C_ID_PIOA ) ;

   	//* then, we configure the PIO Lines corresponding to LED1 to LED8
   	//* to be outputs. No need to set these pins to be driven by the PIO because it is GPIO pins only.
    	AT91F_PIO_CfgOutput( AT91C_BASE_PIOA, LED_MASK ) ;
   	//* Clear the LED's. On the EB55 we must apply a "1" to turn off LEDs
		AT91F_PIO_SetOutput( AT91C_BASE_PIOA, LED_MASK ) ;

    //* open external PIO interrupt
    //* define switch SW1 at PIO input for interrupt IRQ loop
 	    AT91F_PIO_CfgInput(AT91C_BASE_PIOA, SW_MASK);
 	    		 
		while(1)
		{
			AT91F_DBGU_Printk("\n\r---------  Enter CANBusTest(Y/N)----------\n\r");		
			caractere = AT91F_DBGU_getc();
			switch(caractere)
			{
				case 'Y':
			
				case 'y':	

					CANBus_test();			
					break;
			
				default:
				AT91F_DBGU_Printk("\n\rBad choice, Retry please\n\r");
				break;

			}
		}							  							
		       
//* End
}

⌨️ 快捷键说明

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