crazydog2009 发表于 2013-6-27 13:30:55

lpc1114IO控制不了?

我试着控制1114的IO,却只有部分IO能变化,但我也没有做其它任何动作,只是初始化了IO!
#include <lpc11xx.h>
#include "gpio.h"

void GPIO_Configuration(void);
voidDelay (uint32_t nCount);



int main(void)
{
        GPIOInit();
        GPIO_Configuration();
        while(1)
        {
                GPIOSetValue(PORT0,0,HIGH);
                GPIOSetValue(PORT0,1,HIGH);
                GPIOSetValue(PORT0,2,HIGH);       
                GPIOSetValue(PORT0,4,HIGH);
                GPIOSetValue(PORT0,5,HIGH);
                GPIOSetValue(PORT0,6,HIGH);
                GPIOSetValue(PORT0,8,HIGH);
                GPIOSetValue(PORT0,9,HIGH);
                GPIOSetValue(PORT0,10,HIGH);       
                GPIOSetValue(PORT0,11,HIGH);

                GPIOSetValue(PORT1,0,HIGH);
                GPIOSetValue(PORT1,1,HIGH);
                GPIOSetValue(PORT1,2,HIGH);
                GPIOSetValue(PORT1,3,HIGH);
                GPIOSetValue(PORT1,6,HIGH);
                GPIOSetValue(PORT1,7,HIGH);

                Delay(0xfffff);
                GPIOSetValue(PORT0,0,LOW);
                GPIOSetValue(PORT0,1,LOW);
                GPIOSetValue(PORT0,2,LOW);       
                GPIOSetValue(PORT0,4,LOW);
                GPIOSetValue(PORT0,5,LOW);
                GPIOSetValue(PORT0,6,LOW);
                GPIOSetValue(PORT0,8,LOW);
                GPIOSetValue(PORT0,9,LOW);
                GPIOSetValue(PORT0,10,LOW);       
                GPIOSetValue(PORT0,11,LOW);

                GPIOSetValue(PORT1,0,LOW);
                GPIOSetValue(PORT1,1,LOW);
                GPIOSetValue(PORT1,2,LOW);
                GPIOSetValue(PORT1,3,LOW);
                GPIOSetValue(PORT1,6,LOW);
                GPIOSetValue(PORT1,7,LOW);
                Delay(0xfffff);
                       
        }
}

/*******************************************************************************
* Function Name: Delay
* Description    : Delay Time
* Input          : - nCount: Delay Time
* Output         : None
* Return         : None
* Attention               : None
*******************************************************************************/
voidDelay (uint32_t nCount)
{
for(; nCount != 0; nCount--);
}

/*******************************************************************************
* Function Name: GPIO_Configuration
* Description    : Configure GPIO Pin
* Input          : None
* Output         : None
* Return         : None
* Attention               : None
*******************************************************************************/
void GPIO_Configuration(void)
{
        GPIOSetDir(PORT0,0,OUT);
        GPIOSetDir(PORT0,1,OUT);
        GPIOSetDir(PORT0,2,OUT);       
        GPIOSetDir(PORT0,4,OUT);
        GPIOSetDir(PORT0,5,OUT);
        GPIOSetDir(PORT0,6,OUT);
        GPIOSetDir(PORT0,8,OUT);
        GPIOSetDir(PORT0,9,OUT);
        GPIOSetDir(PORT0,10,OUT);       
        GPIOSetDir(PORT0,11,OUT);

        GPIOSetDir(PORT1,0,OUT);
        GPIOSetDir(PORT1,1,OUT);
        GPIOSetDir(PORT1,2,OUT);
        GPIOSetDir(PORT1,3,OUT);
        GPIOSetDir(PORT1,6,OUT);
        GPIOSetDir(PORT1,7,OUT);       
                       
}

把这个代码烧到1112就更不靠谱了,一个IO都没有动,本人初学,求大虾指路,十分感谢
页: [1]
查看完整版本: lpc1114IO控制不了?