Set reception acceptance.
Ret = CanSetChannelAcceptance ( Id , ChannelNo , MessageTypeMask , CanIdMask , CanIdCode )
Id
[ VB.NET: Short ] [ C, C++: short ] [ C#: short ]
Specify the device ID retrieved from CanInit.
ChannelNo
[ VB.NET: UShort ] [ C, C++: unsigned short ] [ C#: ushort ]
Specify the channel number.
MessageTypeMask
[ VB.NET: UInteger ] [ C, C++: unsigned long ] [ C#: uint ]
Specify message types that you do not want to receive.
Message types with specified bits will not be received.
When specifying multiple message types, perform
bitwise operations using logical OR.
For example, if it is 0x00, there is no message type specified, so all
message types will be received.
Definition |
Value |
Description |
CCAN_MSG_TYPE_DISABLE |
0x00 |
Not specified (all message types will be received) |
CCAN_MSG_TYPE_CAN |
0x01 |
CAN message |
CCAN_MSG_TYPE_CAN_FD |
0x02 |
CAN FD message |
CCAN_MSG_TYPE_REMOTE_FRAME |
0x04 |
Remote frame. *Only CAN can be enabled |
CCAN_MSG_TYPE_BITRATE_SWITCH |
0x08 |
Bitrate switch. *Only CAN FD can be enabled |
CCAN_MSG_TYPE_EXTENDED_FORMAT |
0X20 |
Extended format |
CanIdMask
[ VB.NET: UInteger ] [ C, C++: unsigned long ] [ C#: uint
]
Specify the mask for the CAN IDs to be received.
When standard format is specified, specify
with base ID (11bit).
Valid specification range is 0x000 to 0x7FF.
If you specify 0x000, all CAN ID messages will be stored in the receive
buffer.
When you specify 0x7FF, all CAN ID messages are the filtered target. And
you can designate some of CAN ID messages to be stored in the receive
buffer with CanIdCode.
When extended format is specified, specify
it as extended ID + base ID (29 bits in total).
Valid specification range is 0x000 to 0x1FFFFFFF.
If you specify 0x00000000, all CAN ID messages are the filtered target.
And you can designate some of CAN ID messages to be stored in the receive
buffer with CanIdCode.
CanIdMask |
31 |
30 |
29 |
28 |
27 |
26 |
25 |
24 |
23 |
22 |
21 |
20 |
19 |
18 |
17 |
16 |
15 |
14 |
13 |
12 |
11 |
10 |
09 |
08 |
07 |
06 |
05 |
04 |
03 |
02 |
01 |
00 |
Extended ID/Base ID |
- |
- |
- |
Extended ID |
Base ID |
|||||||||||||||||||||||||||
Bit number of each ID |
- |
- |
- |
17 |
16 |
15 |
14 |
13 |
12 |
11 |
10 |
09 |
08 |
07 |
06 |
05 |
04 |
03 |
02 |
01 |
00 |
10 |
09 |
08 |
07 |
06 |
05 |
04 |
03 |
02 |
01 |
00 |
CanIdCode
[ VB.NET: UInteger ] [ C, C++: unsigned long ] [ C#: uint
]
Indicate the CAN ID with code to be stored in the receive buffer among
the messages filtered by the CanIdMask setting.
When standard format is specified, specify
with base ID (11bit).
Valid specification range is 0x000 to 0x7FF.
If extended format is specified, specify
it as extended ID + base ID (29 bits in total).
The extended ID is the upper bits, and the base ID is the lower bits.
Valid specification range is 0x000 to 0x1FFFFFFF.
CanIdCode |
31 |
30 |
29 |
28 |
27 |
26 |
25 |
24 |
23 |
22 |
21 |
20 |
19 |
18 |
17 |
16 |
15 |
14 |
13 |
12 |
11 |
10 |
09 |
08 |
07 |
06 |
05 |
04 |
03 |
02 |
01 |
00 |
Extended ID/Base ID |
- |
- |
- |
Extended ID |
Base ID |
|||||||||||||||||||||||||||
Bit number of each ID |
- |
- |
- |
17 |
16 |
15 |
14 |
13 |
12 |
11 |
10 |
09 |
08 |
07 |
06 |
05 |
04 |
03 |
02 |
01 |
00 |
10 |
09 |
08 |
07 |
06 |
05 |
04 |
03 |
02 |
01 |
00 |
Ret [ VB.NET: Integer ] [ C, C++: long ] [ C#: int ]
Definition |
Value [Dec] |
Description |
CAN_ERR_SUCCESS |
0 |
Normality completion |
CAN_ERR_SYS_RECOVERED_FROM_STANDBY |
7 |
Execute CanResetDevice function because the device has recovered from standby mode. |
CAN_ERR_DLL_INVALID_ID |
10001 |
Invalid ID was specified. |
CAN_ERR_DLL_CALL_DRIVER |
10002 |
Driver can't be called (Failed in the device I/O control). |
CAN_ERR_SYS_CH_NO |
20101 |
Channel number is outside the settable range |
CAN_ERR_SYS_DATA_FRAME_FORMAT |
20102 |
The data frame format is outside the settable range. |
The others (See also: Details of Error Code)
MessageTypeMask = 0x00 (CCAN_MSG_TYPE_DISABLEL.
Not specified (all message types will be received))
CanIdMask = 0x00000000 (All messages are stored in the receive buffer)
CanIdCode = 0x00000000
Set reception acceptance.
This can be set only when the bus is not connected.
In addition to store only one CAN ID message
to the receive buffer, you can store the multiple CAN ID messages to the
receive buffer by combining CanIdMask and CanIdCode.
Please refer "Examples
of the combination for CanIdMask and CanIdCode setting" topic
to know more details.
Set CanIdMask = 2043, CanIdCode = 3 with standard format CAN communication to ChannelNo = 1. The decimal number 2043 is expressed as 0x7FB in hexadecimal.
VB.NET |
Dim Ret As Integer Ret = CanSetChannelAcceptance
( Id , 1 , CCAN_MSG_TYPE_CAN , 2043 , 3 ) |
C, C++ |
long Ret; Ret = CanSetChannelAcceptance
( Id , 1 , CCAN_MSG_TYPE_CAN , 2043 , 3 ); |
C# |
int Ret; Ret = can.SetChannelAcceptance
( Id , 1 , CCAN_MSG_TYPE_CAN , 2043 , 3 ); |