我之前用的是P0^0,后来改成P7^0就没法实现功能了端口初始化的函数是:
void Port_Init (void)
{
char SFRPAGE_SAVE = SFRPAGE; // Save Current SFR page
SFRPAGE = CONFIG_PAGE; // Set SFR page
// Enable crossbar
XBR2 = 0x40;
P1MDOUT = 0xff;
P2MDOUT = 0xff;
P3MDOUT = 0xff;
P0MDOUT = 0xff;
P4MDOUT = 0xff;
P7MDOUT = 0xff;
SFRPAGE = SFRPAGE_SAVE; // Restore SFR page
}
寄存器页需要切换吗? |