新聞中心

EEPW首頁 > 模擬技術(shù) > 設(shè)計應(yīng)用 > 基于LPC1114的學(xué)習(xí)型紅外遙控器程序設(shè)計

基于LPC1114的學(xué)習(xí)型紅外遙控器程序設(shè)計

作者: 時間:2012-04-25 來源:網(wǎng)絡(luò) 收藏

本設(shè)計就是采用+OLED+接收頭構(gòu)成一個

  安 裝LPCxpress,后插入LPC-Link 自動識別,

  系統(tǒng)多出一個

  

基于LPC1114的學(xué)習(xí)型紅外遙控器程序設(shè)計

  然后打開11XX的例程,正常安裝路徑在C:nxp lpcxpresso_3.1ExamplesLPC1000LPC11xx下

  文件名字 LPCXpresso1114_v1.00.zip

  然后點擊GPIO程序,打開GPIOtest.c開始學(xué)習(xí)。

  發(fā)現(xiàn)和普通的 8位機真的相差很多,用了很多類似函數(shù)(庫)的東西。

  別的不管,先來個最簡單的閃爍燈。

  找到函數(shù)

  功能:(設(shè)置 GPIO口方向),參數(shù)(端口號,位,輸入或輸出(0入1出))

  GPIOSetDir( PORT0, 1, 0 );

  和

  GPIOSetValue()

  一 個是設(shè)置端口方向,一個是設(shè)置輸出的值,直接調(diào)用就可以了。

  下面是我的程序,本人菜鳥一只,程序也不會寫,希望大家拍磚的話,別往死里拍, 呵呵。

  用的是P32的口。輸出1的時候點亮LED。

  /*****************************************************************************

  * gpiotest.c: main C entry file for NXP LPC11xx Family Microprocessors

  *

  * Copyright(C) 2008, NXP Semiconductor

  * All rights reserved.

  *

  * History

  * 2009.12.07 ver 1.00 Preliminary version, first Release

  *

  ******************************************************************************/

  #include "LPC11xx.h" /* LPC11xx Peripheral Registers */

  #include "gpio.h"

  /*****************************************************************************

  ** Main Function main()

  ******************************************************************************/

  int main (void)

  {

  /* Basic chip initialization is taken care of in SystemInit() called

  * from the startup code. SystemInit() and chip settings are defined

  * in the CMSIS system_.c file.

  */

  uint32_t a=60000;

  GPIOInit();

  GPIOSetDir(PORT3,2,1);

  while(1)

  {

  a=160000;

  while(a--);

  GPIOSetValue(PORT3,2,0);

  a=160000;

  while(a--);

  GPIOSetValue(PORT3,2,1);

  }

  /* use port0_1 as input event, interrupt test. */

  GPIOSetDir( PORT0, 1, 0 );

  /* port0_1, single trigger, active high. */

  GPIOSetInterrupt( PORT0, 1, 0, 0, 0 );

  GPIOIntEnable( PORT0, 1 );

  /* use port1_1 as input event, interrupt test. */

  GPIOSetDir( PORT1, 1, 0 );

  /* port0_1, single edge trigger, active high. */

  GPIOSetInterrupt( PORT1, 1, 0, 0, 0 );

  GPIOIntEnable( PORT1, 1 );

  /* use port2_1 as input event, interrupt test. */

  GPIOSetDir( PORT2, 1, 0 );

  /* port0_1, single edge trigger, active high. */

  GPIOSetInterrupt( PORT2, 1, 0, 0, 0 );

  GPIOIntEnable( PORT2, 1 );

  /* use port3_1 as input event, interrupt test. */

  GPIOSetDir( PORT3, 1, 0 );

  /* port0_1, single edge trigger, active high. */

  GPIOSetInterrupt( PORT3, 1, 0, 0, 0 );

  GPIOIntEnable( PORT3, 1 );

  while( 1 );

  }

  /*********************************************************************************

  ** End Of File

  *********************************************************************************/



評論


相關(guān)推薦

技術(shù)專區(qū)

關(guān)閉