This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

IO设置



/* 1 - D1 blue */
#define LED1_BV BV(0)
#define LED1_SBIT P2_0 
#define LED1_DDR P2DIR
#define LED1_POLARITY ACTIVE_LOW

P2_0  设置为驱动LED (蓝灯)

/* set direction for GPIO outputs */ \
LED1_DDR |= LED1_BV; \
LED2_DDR |= LED2_BV; \
GYRO_VDD_DDR |= GYRO_VDD_BV; \
DCDC_DDR |= DCDC_BV; /* Set P0_7 as output */ \
GYRO_VDD_SBIT = 1; /* Gyro must be on for I2C to work */ \
P0DIR |= BV(5); /* Unused pin as output */ \
P2DIR |= 0x01 /* Unused pin as output */ \
P1DIR |= 0xBC; /* UART pins as output */ \
P0INP = 0x4E; /* Tri-state inputs */ \
}

// use this to turn LEDs off during sleep
P2_0 = 1;
HalLedEnterSleep();

P2.0设置为一般I O ,P2SEL=0

无论怎么设置P2_0总是输出低电平 0.4V电压,LED2  P1_7就正常,请哪位帮我指点,谢谢了。

wulun