新聞中心

        EEPW首頁 > 模擬技術 > 設計應用 > 基于LPC1114的學習型紅外遙控器程序設計

        基于LPC1114的學習型紅外遙控器程序設計

        作者: 時間:2012-04-25 來源:網絡 收藏

        本設計就是采用+OLED+接收頭構成一個

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

          系統多出一個

          

        基于LPC1114的學習型紅外遙控器程序設計

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

          文件名字 LPCXpresso1114_v1.00.zip

          然后點擊GPIO程序,打開GPIOtest.c開始學習。

          發現和普通的 8位機真的相差很多,用了很多類似函數(庫)的東西。

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

          找到函數

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

          GPIOSetDir( PORT0, 1, 0 );

          和

          GPIOSetValue()

          一 個是設置端口方向,一個是設置輸出的值,直接調用就可以了。

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

          用的是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

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



        評論


        相關推薦

        技術專區

        關閉
        主站蜘蛛池模板: 盈江县| 泸西县| 马鞍山市| 连南| 津南区| 新巴尔虎左旗| 合水县| 岳西县| 嘉黎县| 扎赉特旗| 北海市| 富平县| 昌黎县| 克拉玛依市| 宜章县| 海丰县| 卫辉市| 明溪县| 手游| 温州市| 定襄县| 南投县| 桃江县| 休宁县| 丁青县| 旺苍县| 额济纳旗| 泸水县| 托克托县| 大荔县| 扎鲁特旗| 万宁市| 红河县| 利辛县| 麻江县| 波密县| 山阳县| 固安县| 乐亭县| 沿河| 前郭尔|