在线时间4 小时
UID3387929
注册时间2017-5-20
NXP金币0
该用户从未签到
新手上路

- 积分
- 32
- 最后登录
- 2017-6-11
|

楼主 |
发表于 2017-5-21 19:59:46
|
显示全部楼层
非常感谢您的帮助,这是我在例程gpio_handson_1的C文件main_gpio_handson1.c的基础上稍微做的修改
#include "board.h"
#define LED1_PIN 7
#define LED2_PIN 13
#define LED3_PIN 16
static void delay(void)
{
uint32_t i, j;
for(i=0; i<1000; i++)
for(j=0; j<1000; j++);
}
int main(void)
{
uint32_t GPIOCONFIG1 = ( (1 << LED1_PIN) | (1 << LED2_PIN) | (1 << 27) );
SystemCoreClockUpdate();
Board_Init();
/* Set port 0 pins 7,13,16 to the output direction*/
Chip_GPIO_PortSetDIR(LPC_GPIO_PORT, 0, GPIOCONFIG1, 1);
/* Set GPIO port mask value to make sure only port 0
pins 0-3 (0-1 on 824) are active during state change */
Chip_GPIO_PortSetState(LPC_GPIO_PORT, 0, 1);
/* All work happens in the systick interrupt handler */
while (1)
{
Chip_GPIO_PortSetOutLow(LPC_GPIO_PORT, 0, GPIOCONFIG1);
//Chip_GPIO_PortSetOutHigh(LPC_GPIO_PORT, 0, GPIOCONFIG1);
}
}
发现如果不注释掉Chip_GPIO_PortSetState(LPC_GPIO_PORT, 0, 1);(无论最后一个参数赋值多少)则所有用户灯都会常亮,即至少所有用户灯端口都输出低电平 |
|