1_001: 发送缓冲器
PIC18Fxx8系列CAN有3个发送缓冲器,每个缓冲器都有14个字节的SRAM,处于模块的存储器地址中。
若MCU要对信息缓冲器进行写访问,则TXREQ位必须清0以表示信息缓冲器已经将任何要发的信息清除。至少TXBnSIDH、TXBnSIDL和TXBnDLC寄存器必须被装载。如果信息中有数据字节,TXBnDm寄存器也应该被装载。如果信息使用扩展标识符,那么TXBnEIDm也应该被装载,而且将EXIDE位置1。
在发送信息之前,MCU必须对TXBnIE位初始化以控制信息发送期间是否产生中断。同样,MCU也必须初始化TXP优先级位。
***************************************************************
(1) 发送缓冲器n控制寄存器TXBnCONbits: TXREQ发送请求状态位,1=请求发送信息,清除TXABT / TXLARB / TXERR位;0=当信息成功发送后自动清0 [注]当此位置1时,用软件清0将要求中止信息。
CAN发送缓冲器优先级位TXPRI1、TXPRI0 11=3级优先级(最高),10=2级优先级,01=1级优先级,00=0级优先级(最低)
(2) TXBnSIDH发送缓冲器n标准标识符高字节寄存器组,TXBnSIDL低字节寄存器组;TXBnDLC发送缓冲器n数据长度代码寄存器组;TXBnDm发送缓冲器n数据字节寄存器组; TXBnEIDH发送缓冲器n扩展标识符高字节寄存器组,TXBnEIDL低字节寄存器组;
(3) TXBnSIDLbits: EXIDE 扩展标识符使能位。1=信息将发送到扩展ID, SID10:SID0变成EID28:EID18; 0=信息将发送到标准ID,EID17:EID0被忽略。
(4) 外围中断使能寄存器组PIE3bits:CAN 发送缓冲器n中断使能位TXB2IE、TXB1IE、TXB0IE,1=使能发送缓冲器n中断,0=禁止发送缓冲器n中断
****************************************************************************
TRANSMIT BUFFERS
The PIC18FXX8 implements three Transmit Buffers. Each of these buffers occupies 14 bytes
of SRAM and are mapped into the device memory map.
For the MCU to have write access to the message buffer, the TXREQ bit must be clear, indicating that the message buffer is clear of any pending message to be transmitted. At a minimum, the TXBnSIDH, TXBnSIDL, and TXBnDLC registers must be loaded. If data bytes
are present in the message, the TXBnDm registers must also be loaded. If the message is to use extended identifiers, the TXBnEIDm registers must also be loaded and the EXIDE bit set.
Prior to sending the message, the MCU must initialize the TXBnIE bit to enable or disable the generation of an interrupt when the message is sent. The MCU must also initialize the TXP priority bits .
用户1787021 2014-9-26 21:53
ilove314_323192455 2009-1-11 22:23
用户1404984 2009-1-11 21:10
用户1027019 2008-4-15 11:17
用户1070072 2008-4-10 14:54