Micom_Electric/CAN 2011. 8. 14. 20:55
LCD에 OBD 데이터 표시하는 프로젝트..
고생한곳 ...
- CAN ID filter 사용해서 필요한 것만 읽는다
 
http://www.kreatives-chaos.com/artikel/universelle-can-bibliothek

Hello Jens, 
Or must I set the library at compile what? 
No, nothing to do with the filters. 
Suppose you want only default message with the identifiers of 0x123 and 0x456 received. Then you can set the filter as follows: 
prog_uint8_t can_filter [] = 
{ 
    
/ / Group 0 
    
MCP2515_FILTER (0x123), / / ​​Filter 0 
    
MCP2515_FILTER (0x123), / / ​​Filter 1 

    
/ / Group 1 
    
MCP2515_FILTER (0x456), / / ​​Filter 2 
    
MCP2515_FILTER (0x456), / / ​​Filter 3 
    
MCP2515_FILTER (0x456), / / ​​filter 4 
    
MCP2515_FILTER (0x456), / / ​​Filter 5 

    
MCP2515_FILTER (0x7FF) / / Mask 0 (for group 0) 
    
MCP2515_FILTER (0x7FF) / / Mask 1 (for group 1) 
}; 
... 
can_static_filter (can_filter); 
Now receives the first register is the identifier 0x123 and 0x456 only the second. Will you receive with two registers both identifiers must be as follows: 
prog_uint8_t can_filter [] = 
{ 
    
/ / Group 0 
    
MCP2515_FILTER (0x123), / / ​​Filter 0 
    
MCP2515_FILTER (0x456), / / ​​Filter 1 

    
/ / Group 1 
    
MCP2515_FILTER (0x123), / / ​​Filter 2 
    
MCP2515_FILTER (0x123), / / ​​Filter 3 
    
MCP2515_FILTER (0x456), / / ​​filter 4 
    
MCP2515_FILTER (0x456), / / ​​Filter 5 

    
MCP2515_FILTER (0x7FF) / / Mask 0 (for group 0) 
    
MCP2515_FILTER (0x7FF) / / Mask 1 (for group 1) 
}; 
... 
can_static_filter (can_filter); 
Both versions should really just let the two identifiers and by no others. 
For extended messages you have just MCP2515_FILTER MCP2515_FILTER_EXTENDED replaced by the values ​​and adjust accordingly. 
Greetings Fabian 
# George said on 27 November 2009, 10:31 said: 
Hello, I know not what's exactly wrong, I have only the problem that I command only with the can_get_message; often do not receive the data, even though I've set the filters correctly. It was only when I go to the can_get_message; again can_send_message; write, the controller receives new messages. So I thought to myself that the MCP-controller is not the old data from the buffer clears. For safety, again my filter: 
prog_char can_filter [] = 
{ 
MCP2515_FILTER_EXTENDED (0x12345678), / / ​​Filter 0 
MCP2515_FILTER_EXTENDED (0x12345678), / / ​​Filter 1 

MCP2515_FILTER_EXTENDED (0x12345678), / / ​​Filter 2 
MCP2515_FILTER_EXTENDED (0x12345678), / / ​​Filter 3 
MCP2515_FILTER_EXTENDED (0x12345678), / / ​​filter 4 
MCP2515_FILTER_EXTENDED (0x12345678), / / ​​Filter 5 

MCP2515_FILTER_EXTENDED (0x1FFFFFFF) / / Mask 0 
MCP2515_FILTER_EXTENDED (0x1FFFFFFF) / / mask 1 
}; 
I would like to receive only one file. I then also the problem that I have 7 Can controller, and all should receive different messages. It does not work at all, although all have the same controller and the same code with a different ID? S. 
Perhaps it has to do with the fact that I interrupts the MCP? S and have always turned off after 10 ms the controller itself auslese (I need to do, because otherwise I have too many interrupts)? 
Thank you ever for the help!
 
posted by 털보네i
: