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.
uС MSP430f5244 UCB1有可能在没有 SOMI 引脚(P4.2/PM_UCB1SOMI / PM_UCB1SC)的情况下安装、被用作数字 I/O?
//设置端口引脚
P4DIR = 0xFF; // P4.0 - P4.7输出
P4SEL = BIT1+BIT3; // P4.1、P4.3端口映射函数
P4OUT = 0x00;
空端口映射(空)
{
_disable_interrupt (); //在修改端口映射寄存器之前禁用中断
PMAPPWD = 0x02D52; //启用写入访问以修改端口映射寄存器
#ifdef port_map_RECFG
PMAPCTL = PMAPRECFG; //允许在运行时重新配置
#endif
P4MAP0 = PM_NONE;
P4MAP1 = PM_UCB1SIMO;
P4MAP2 = PM_NONE;
P4MAP3 = PM_UCB1CLK;
P4OMAP4 = PM_NONE;
P4MAP5 = PM_NONE;
P4MAP6 = PM_NONE;
PMAPPWD = 0; //禁用写访问以修改端口映射寄存器
#ifdef port_map_EINT
_ENABLE_INTERRUPT (); //重新启用所有中断
#endif
}
谢谢。
您好、Albert、
是的。 通过查看 MSP430x5xx6xx 用户指南中的端口4引脚功能表、您可以看到是否要使引脚 P4.2成为数字引脚、而不是用作 SOMI、然后如 图所示设置位 P4SEL.2 = 0。
//指令只清除位#2
P4SEL &=~(GPIO_BIT2);