2701| 2
|
串口 和 can 在发送数据的 时候能被中断吗? |
1金钱
最佳答案可以被中断,但是中断的时间要控制好,不能太长。
按Modbus协议,如果两个字节之间的空闲间隔时间大于1.5个字节传输时间,则认为帧不完整丢弃掉;如果大于3.5个字节传输时间,则作为两帧处理。
当波特率很高时,1.5个字节传输时间按不低于750us算,3.5个字节传输时间按不低于1.75ms算。
如果这个时间间隔做不到的话,那就把串口中断优先级设置高一些,这样也可以。
| ||
| ||
| ||
He who fights with monsters should look to it that he himself does not become a monster, when you gaze long into the abyss, the abyss also gazes into you.
过于执着就会陷入其中,迷失自己,困住自己。 |
||
|手机版|OpenEdv-开源电子网
( 粤ICP备12000418号-1 )
GMT+8, 2025-6-9 08:18
Powered by OpenEdv-开源电子网
© 2001-2030 OpenEdv-开源电子网