freedomhit

方向摇摆主函数中断程序

0
阅读(4607)

 


#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)
	{

		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 
#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)
	{

		GP4DAT ^= 0x00040000;		// Complement P4.2
		write(0,output1,13);		// Output Data
//		jchar = getchar();			// RX Data, Single Byte
//		write(0,&jchar,1);			// Output Rxed Data
	}
}

中断函数与之前的函数相同。大家复制一下就行了