Пример #1
0
void PIOINT2_IRQHandler(void)
{
  DWORD regVal;
  regVal=LPC_GPIO2->MIS;
	if ( regVal&EXTINT2PIN0MASK )
	{
		#ifdef USE_LCD
		LcdPutString(0,"2");
		#endif
		USBDMnusPullDown();
		SetBit(2,6);
		LPC_GPIO2->IC |=EXTINT2PIN0MASK;
	}
  	else if ( regVal&EXTINT2PIN1MASK )
	{
		#ifdef USE_LCD
		LcdPutString(0,"3");
		#endif
		USBDMnusPullUp();
		ClrBit(2,6);
		LPC_GPIO2->IC |=EXTINT2PIN1MASK;
	}
	else if ( regVal&EXTINT2PIN2MASK )
	{
		#ifdef USE_LCD
		LcdPutString(0,"4");
		#endif
				USBDMnusPullUp();
		ClrBit(2,6);
		LPC_GPIO2->IC |=EXTINT2PIN2MASK;
	}
  return;
}
Пример #2
0
int main(void)
{
	/* Clock Config */
	RCC_Configuration();
	/* Configure the GPIO ports */
	//GPIO_Configuration_Main();
	/* Interrupt Config */
	NVIC_Configuration();
	///////////////// SDCARD Initialisation ////
//	SDCard_Configuration();
//	res = f_open(&fsrc, "a.txt", FA_OPEN_ALWAYS | FA_WRITE |FA_READ);
//	if(res==FR_OK)
//		printf("File opened successfully.\n\r");
//	else 
//	{
//		printf("File open error.\n\r");
//		return 1;
//	}
//	printf("****************File Start***************\n\r");
//	while(f_read(&fsrc, fileBuff, buffsize,&br)==FR_OK)
//	{
//		printf("\n\r%s\n\r",fileBuff);
//		if(br!=buffsize)
//			break;
//	}
//	printf("****************File End*****************\n\r");
//	if(f_close(&fsrc)==FR_OK)
//		printf("\n\rFile closed.\n\r");
	LcdInit();
	while(1)
	{	
		LcdWriteDC(COMMAND , 0x0c );	/*标准显示模式*/
		//	LcdDrawBitmap(0, 0, (uint8_t *)logo, 80, 6);  //画一个接近全屏的位图
		LcdPutString(0, 0, "Nokia 5110 LCD");  //在位图的左上方覆盖英文字符
		LcdPutString(0, 1, "--0123456789--");  //在位图的左上方覆盖英文字符
		LcdPutString(0, 2, "--9876543210--");  //在位图的左上方覆盖英文字符
		LcdPutString(0, 3, "--0123456789--");  //在位图的左上方覆盖英文字符
		LcdPutString(0, 4, "--9876543210--");
		LcdPutString(0, 5, "--0123456789--");
		Delaynus(1000000);
		
		LcdWriteDC(COMMAND , 0x0d);   /*反显*/
		Delaynus(1000000);
	}
}