Tifr1写入无效?ATMega2560

void setup()
{
  Serial.begin(9600);
  Serial.write(TIFR1);
  TIFR1=12;
  Serial.write(TIFR1);
}
void loop()
{
}

结果串口另一端收到的是两个0?TIFR1的写入没有生效?

PS:
串口另一端连PC上运行的MATLAB。MATLAB用如下代码监视串口:

Serial=serialport("COM3",9600);
Serial.configureCallback("byte",1,@(~,~)fprintf(" "+num2str(Serial.read(1,"uint8"))));

TIFR1 = 0b00001100

您更改位 2 和 3
位 3 是只读的
在第 2 位写入 1 清除该位

感谢谷歌翻译 :slight_smile:

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.