写了段程序,调试时显示”你尝试修改模拟引脚,大牛看看
写了段程序,调试时显示”你尝试修改模拟引脚,大牛看看。CPU:C8051F023
引脚分配图:
void set_tx_pin_low()
{
//P1MDIN=0xff;
SimUart1_TxPort=ClrBit_(SimUart1_TxPort,SimUart1_TxPortbit);
//P1=0;
}
P1配置里面有模拟量输入引脚。
P1寄存器难道不能整个写入,要用位寻址吗?
代码改成下面的就不出来了:
sbit SimUart1_TxPort = P1^2;
void set_tx_pin_low()
{
//P1MDIN=0xff;
//SimUart1_TxPort=ClrBit_(SimUart1_TxPort,SimUart1_TxPortbit);
SimUart1_TxPort=0;
}
void set_tx_pin_high()
{
//P1MDIN=0xff;
//SimUart1_TxPort=SetBit_(SimUart1_TxPort,SimUart1_TxPortbit);
SimUart1_TxPort=1;
}
页:
[1]