freedomhit

单双击中断程序及主函数

0
阅读(13320)

 

#include 
#include  	
//extern int write (int file, char * ptr, int len);	// Functions used to 
//extern int getchar (void);							// to output data 	 
//extern int putchar(int);                     		// Write character to Serial Port  
#include "serial.h"

int main (void)  {
//  unsigned char jchar = 0x30;

	char output1[13] = "Hello World\n";
	
	// Setup tx & rx pins on P1.0 and P1.1
	GP1CON = 0x011;

   	// Start setting up UART at 9600bps
   	COMCON0 = 0x080;				// Setting DLAB
   	COMDIV0 = 0x088;				// Setting DIV0 and DIV1 to DL calculated
   	COMDIV1 = 0x000;
   	COMCON0 = 0x003;				// Clearing DLAB

	GP4DAT = 0x04000000;			// P4.2 configured as an output. LED is turned on

	while(1)/*    Function Pointers for Interrupts  */
typedef void (* tyVctHndlr) (void);

tyVctHndlr    IRQ     = (tyVctHndlr)0x0;
tyVctHndlr    SWI     = (tyVctHndlr)0x0;
tyVctHndlr    FIQ     = (tyVctHndlr)0x0;
tyVctHndlr    UNDEF   = (tyVctHndlr)0x0;
tyVctHndlr    PABORT  = (tyVctHndlr)0x0;
tyVctHndlr    DABORT  = (tyVctHndlr)0x0;

void	IRQ_Handler   (void) __irq;
void	SWI_Handler   (void) __irq;
void	FIQ_Handler   (void) __irq;
void	Undef_Handler (void) __irq;
void	PAbt_Handler  (void) __irq;
void	DAbt_Handler  (void) __irq;

void	IRQ_Handler(void) __irq
{
	if ( *IRQ !=0x00)
	{
		IRQ();
	}
} 

void	FIQ_Handler(void) __irq
{
	if ( *FIQ !=0x00)
	{
		FIQ();
	}
}

void	SWI_Handler(void) __irq
{
	if ( *SWI !=0x00)
	{
		SWI();
	}
}

void	Undef_Handler(void)__irq 
{
	if ( *UNDEF !=0x00)
	{
		UNDEF();
	}
}

void	PAbt_Handler(void) __irq
{
	if ( *PABORT !=0x00)
	{
		PABORT();
	}
}

void	DAbt_Handler(void) __irq
{
	if ( *DABORT !=0x00)
	{
		DABORT();
	}
}
{ GP4DAT ^= 0x00040000; // Complement P4.2 write(0,output1,13); // Output Data // jchar = getchar(); // RX Data, Single Byte // write(0,&jchar,1); // Output Rxed Data } }
#include "main.h"
#include "IIC.h"
unsigned int ValueX,ValueY,ValueZ;
int XAPP,YAPP,ZAPP;
	
/*uchar putx[6],puty[6],putz[6];	//将计算所的的整形数转变成字符数组以便在液晶输出
void conversion(unsigned char * put,int temp_data)  
{  
    put[0]=temp_data/10000+'0' ;
 //   temp_data=temp_data%10000;   //取余运算
	put[1]=temp_data%10000/1000+'0' ;
 //   temp_data=temp_data%1000;    //取余运算
    put[3]=temp_data%10000%1000/100+'0' ;
 //   temp_data=temp_data%100;     //取余运算
    put[4]=temp_data%10000%1000%100/10+'0'    ;
 //   temp_data=temp_data%10;      //取余运算
    put[5]=temp_data%10000%1000%100%10+'0'; 
	put[2]='.';	
}
	
 */
int main()
{	  
     lcd_initial(); 
	 LCD_Delay(10);
   	/* Init_IIC();	
	 
	 while(1)
	{ 	
		 Value_ADXL345() ;
	     conversion(putx,XAPP);
		 conversion(puty,YAPP);
		 conversion(putz,ZAPP);
	
	 	disp_str(0,0,"Aspeed (Unit: g)");
		disp_str(32,2,"X :");

		disp_str(32,4,"Y :");
		disp_str(32,6,"Z :");
    	disp_str(78,2,putx);
		disp_str(78,4,puty);
		disp_str(78,6,putz);
	//	disp_word(10,5,wan);
	//	disp_word(18,5,qian);
	//	disp_word(26,5,bai);
	//	disp_word(34,5,shi);
	//	disp_word(42,5,ge);
	   
    //	 clear_screen(0); 
		 delay(400000);	
	}  */
	Init_IIC();
	while(1)
	{	disp_str(0,0,"hello sti");
		single_tap();
		delay(100000);
	 }

}