新闻中心

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

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



评论


相关推荐

技术专区

关闭