求助一段程序代码,这是标准的CAN协议,也就是11位ID的,我想把它改为29位ID的,不知道该怎么去修改配置,
不清楚的有两点:1.MASK和ID什么关系,ID是29位时,MASK怎么配置?
2.怎么把29位ID配置给寄存器?
求助大神!
MOV CAN0BTL,#0C8H;;CAN0BTL,#47H ;CAN bit rate to 125Kbps
MOV CAN0BTH,#06FH;;CAN0BTH,#5FH
;Message Object 1用于接收
MOV CAN0IF1CML,#0F0H ;Write Mask,Arbitration,Control to Message Object
;IF1 Mask1
MOV CAN0IF1M1L,#00H ;Mask Bits 15-0 not used for filtering
MOV CAN0IF1M1H,#00H
;IF1 Mask2
MOV CAN0IF1M2L,#0FCH ;Ignore Extended Identifier for filtering
MOV CAN0IF1M2H,#5FH ;Used Direction bit for filtering Use ID bits 28-18 for filtering(11个ID位都要仲裁)
;IF1 Arbitration1
MOV CAN0IF1A1L,#00H ;11-bit ID, so lower 16-bits not used
MOV CAN0IF1A1H,#00H
;IF1 Message Control Register
MOV CAN0IF1MCL,#88H ;Message Size=8 Message Object is a Single Message
MOV CAN0IF1MCH,#14H ;Enable Receive Interrupt Use Acceptance Mask
;IF1 Arbitration2
MOV A,#IDCONST2
MOV B,#64
DIV AB
ORL A,#80H
MOV CAN0IF1A2H,A
MOV A,#4
MUL AB
MOV CAN0IF1A2L,A
MOV CAN0IF1CRL,#01H ;Start command request
一周热门 更多>