搜索
bottom↓
回复: 3

关于LPC1766 GPIO 2.2~2.5 的控制没反应 求助下高手 :)

[复制链接]

出0入0汤圆

发表于 2013-12-17 15:30:30 | 显示全部楼层 |阅读模式
各位朋友,在程序里 开起了 uart0 timer0, 准备在P2.2至P2.5,定时输出高低电平,以控制  led  亮灭。

uart0 和 timer0 都工作正常, 但是 GPIO 2.2~2.5 就是不听话,请大家看看 问题在哪里:

int main (void)
{
//  uint32_t data, true_data, i;
        uint8_t times=100 ;

  TargetResetInit();

  NVIC_DeInit();
  NVIC_SCBDeInit();

#if __IRAM
  NVIC_SetVectorTable(NVIC_VectTab_RAM, 0x0);
#else
  NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x0);
#endif

  /* Configure the NVIC Preemption Priority Bits */
  NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
  
  SysTick_Config(100000000UL/1000 - 1);

  UARTInit(0, 115200);
  // UART0 TESTing
  while (times>=1)
          {
                  UART0SendByte(64);
                times--;
                printf("hello\r\n");
          };
   
   if (InitialTimer( 0 , 50000 )) // interval is 1ms.
   { EnableTimer (0)  ; printf(" Timer 0 is enabled.\r\n");}
   else printf (" Timer 0 not initialized.\r\n");

// Four Leds are connected to P2.2 ~ P2.5
  // Set P2.2 ~ 2.5 to GPIO functions.
           
         PINSEL4 &= (~(0x3c));
           PINMODE4 &= (0x00000550);
         PINMODE4 |= (0x00000550);
         FIO2DIR0 |= 0x3c ;
         FIO2MASK0 &= (~(0x3c));


  
  // 初始化I2C接口/* initialize I2c
//        I2CInit( (unsigned int)I2CMASTER );       
        printf("I2C2 is initialized .\r\n");
    putch(64);
        putch(13);
        putch(10);
        puts("hello!");

    // GPIO and Timer testing:       
          while (1)

          {        FIO2SET0 |= 0x3c;
        //        FIO2PIN0 |= 0x3c;

                  System_wait(1000);

                puts("I set");

                FIO2CLR0 |= 0x3c;
        //        FIO2PIN0 &= (~(0x3c));

                System_wait(1000);

                puts (" and then I reset.\r \n");

          };

   

出0入0汤圆

发表于 2013-12-17 16:06:35 | 显示全部楼层
管脚配置不对

出0入0汤圆

 楼主| 发表于 2013-12-17 16:10:22 | 显示全部楼层

请明示 谢谢。

出0入0汤圆

 楼主| 发表于 2013-12-17 19:59:58 | 显示全部楼层
搞定了 查到后来 发现是LPC17xx.h 地址错误  真是晕啊     这种参考文档 真是锻炼人!!!
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-4-19 03:34

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表