1_003:启动发送
为了启动信息发送,TXREQ位必须置位并将每个缓冲器配置成发送。当TXREQ位置1时,TXABT / TXLARB / TXERR位将被清0。
配置TXREQ位并不能启动信息发送,只是仅仅标志着信息缓冲器为发送做好了准备,当器件检测到总线可用时,发送才开始。器件将首先发送已准备好优先级最高的信息。
当发送成功,TXREQ位将被清0,TXBnIF位将被置1。如果TXBnIE位已被置1,将有一个中断发生。
如果信息发送失败,则TXREQ位将保持为1,表示信息仍然未发送,条件标志将被置1。如果信息发送开始但是遇到了错误的条件,那么TXERR和IRXIF位将被置1,并产生一个中断。 如果信息失去仲裁,那么TXLARB位将被置1。
********************************************************************
(1) 外围中断标志寄存器组PIR3bits:
CAN 发送缓冲器n完成中断标志位TXB2IF、TXB1IF、TXB0IF,1=发送缓冲器n完成了信息的发送,可重新装载;0=发送缓冲器n未完成信息的发送
IRXIF: CAN 有效接收信息中断标志位, 1=有效信息出现在CAN总线上;0=无效信息出现
*************************************************************************
INITIATING TRANSMISSION
To initiate message transmission, the TXREQ bit must be set for each buffer to be transmitted. When TXREQ is set, the TXABT, TXLARB and TXERR bits will be cleared.
Setting the TXREQ bit does not initiate a message transmission, it merely flags a message buffer as ready for transmission. Transmission will start when the device detects that the bus is available. The device will then begin transmission of the highest priority message that is ready.
When the transmission has completed successfully, the TXREQ bit will be cleared, the TXBnIF bit will be set, and an interrupt will be generated if the TXBnIE bit is set.
If the message transmission fails, the TXREQ will remain set, indicating that the message is still pending for transmission and one of the following condition flags will be set. If the message started to transmit but encountered an error condition, the TXERR and the IRXIF bits will be set and an interrupt will be generated. If the message lost arbitration, the TXLARB bit will be
set.
文章评论(0条评论)
登录后参与讨论