Function elements: receive RAW-CAN data. IFM CR0403

Add to My manuals
231 Pages

advertisement

Function elements: receive RAW-CAN data. IFM CR0403 | Manualzz

BasicController CR0403

Function elements: receive RAW-CAN data

Content

CAN_RX .................................................................................................................................................70

CAN_RX_ENH .......................................................................................................................................71

CAN_RX_ENH_FIFO .............................................................................................................................73

CAN_RX_RANGE ..................................................................................................................................75

CAN_RX_RANGE_FIFO ........................................................................................................................77

35705

69

BasicController CR0403

CAN_RX

Unit type = function block (FB)

Unit is contained in the library ifm_RawCAN_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35412

>

Description

35369

>

CAN_RX is used for receiving a message.

The FB limits itself to a few functions and the required memory space is low.

CAN_RX filters for the set identifier. If several CAN messages with the same identifier are received in one cycle, only the last / latest message is available.

Parameters of the inputs

35221

Parameter

ENABLE

CHANNEL

ID

Data type

BOOL

BYTE

DWORD

Description

TRUE: execute this function element

FALSE: unit is not executed

> Function block inputs are not active

> Function block outputs are not specified

CAN interface (1...n) depending on the device

Number of the data object identifier: normal frame (2 048 IDs):

0...2 047 = 0x0000 0000...0x0000 07FF extended Frame (536 868 864 IDs):

2 048...536 870 911 = 0x0000 0800...0x1FFF FFFF

>

Parameters of the outputs

35096

Parameter

DATA

RESULT

Data type

ARRAY [0..7] OF BYTE

BYTE

Description received data, (1...8 bytes) feedback of the function block

(possible messages → following table)

Possible results for RESULT:

Value dec | hex

Description

0

1

5

9

242

00

01

05

09

F2

FB is inactive function block execution completed without error

FB is being processed – still receiving

CAN is not active

Error: setting is not possible

70

BasicController CR0403

CAN_RX_ENH

= CAN RX enhanced

Unit type = function block (FB)

Unit is contained in the library ifm_RawCAN_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35415

>

>

Description

In addition, CAN_RX_ENH provides the following possibilities (as opposed to CAN_RX

(→ p. 70 )):

• select the frame type (11 or 29 bits),

• define a mask for the evaluation of the CAN ID.

35364

Bit comparison of

ID and mask:

If ID_MASK-Bit = 0, then CAN-ID-Bit may be = 0 or 1.

If ID_MASK-Bit = 1, then CAN-ID-Bit must be = ID-Bit.

>

With the mask several identifiers can be defined as filters.

Example:

ID = 0x100 = 0b0001 0000 0000

Result

ID_MASK = 0x1F1 = 0b0001 1111 0001

The CAN IDs with the following bit pattern are evaluated:

0bxxx1 0000 xxx0 (x = any), i.e. for this example (all in [hex]):

100, 102, 104, 106, 108, 10A, 10C, 10E,

300, 302, 304, 306, 308, 30A, 30C, 30E,

500, 502, 504, 506, 508, 50A, 50C, 50E,

700, 702, 704, 706, 708, 70A, 70C, 70E

Parameters of the inputs

35227

Parameter

ENABLE

CHANNEL

ID

Extended

(optional use of the parameter)

ID_Mask

(optional use of the parameter)

Data type

BOOL

BYTE

DWORD

BOOL := FALSE

DWORD := 0

Description

TRUE: execute this function element

FALSE: unit is not executed

> Function block inputs are not active

> Function block outputs are not specified

CAN interface (1...n) depending on the device

Number of the data object identifier: normal frame (2 11 IDs):

0...2 047 = 0x0000 0000...0x0000 07FF extended Frame (2 29 IDs):

0...536 870 911 = 0x0000 0000...0x1FFF FFFF

TRUE: extended Frame (ID = 0...2

29 -1)

FALSE: normal Frame (ID = 0...2

11 -1) filter mask for the identifier: if ID_MASK bit = 0, CAN ID bit may be = 0 or 1 if ID_MASK bit = 1, CAN ID bit must be = ID bit

71

BasicController CR0403

Parameters of the outputs

Parameter

MATCHED_ID

DATALENGTHCOUNT

DATA

RESULT

Data type

DWORD

BYTE

ARRAY [0..7] OF BYTE

BYTE

Possible results for RESULT:

Value dec | hex

Description

0

1

5

9

242

00

01

05

09

F2

FB is inactive function block execution completed without error

FB is being processed – still receiving

CAN is not active

Error: setting is not possible

Description number of the data object identifier

= Data Length Count number of the data bytes received received data, (1...8 bytes) feedback of the function block

(possible messages → following table)

34987

72

BasicController CR0403

CAN_RX_ENH_FIFO

= CAN RX enhanced with FiFo

Unit type = function block (FB)

Unit is contained in the library ifm_RawCAN_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35434

>

Description

35359

In addition, CAN_RX_ENH_FIFO provides a FiFo for the received data (as opposed to CAN_RX_ENH

(→ p. 71 )). Thus several CAN messages can be received in one cycle.

No overwriting takes place when the FiFo is full. Inbound messages will be lost.

>

In this event:

► Deactivate and reactive the FB via ENABLE.

> The FiFo is deleted and can be newly filled.

Description to the filter mask: → CAN_RX_ENH

(→ p. 71 ) > chapter

Description

Parameters of the inputs

35227

Parameter

ENABLE

CHANNEL

ID

Extended

(optional use of the parameter)

ID_Mask

(optional use of the parameter)

Data type

BOOL

BYTE

DWORD

BOOL := FALSE

DWORD := 0

Description

TRUE: execute this function element

FALSE: unit is not executed

> Function block inputs are not active

> Function block outputs are not specified

CAN interface (1...n) depending on the device

Number of the data object identifier: normal frame (2 11 IDs):

0...2 047 = 0x0000 0000...0x0000 07FF extended Frame (2 29 IDs):

0...536 870 911 = 0x0000 0000...0x1FFF FFFF

TRUE: extended Frame (ID = 0...2

29 -1)

FALSE: normal Frame (ID = 0...2

11 -1) filter mask for the identifier: if ID_MASK bit = 0, CAN ID bit may be = 0 or 1 if ID_MASK bit = 1, CAN ID bit must be = ID bit

73

BasicController CR0403

>

Parameters of the outputs

Parameter

MATCHED_ID

DATALENGTHCOUNT

DATA

MORE_DATA_AVAILABLE

RESULT

Data type

DWORD

BYTE

ARRAY [0..7] OF BYTE

BOOL

BYTE

Possible results for RESULT:

Value dec | hex

Description

5

9

0

1

242

250

00

01

05

09

F2

FA

FB is inactive function block execution completed without error

FB is being processed

– still receiving

CAN is not active

Error: setting is not possible

Error: FiFo is full – data was lost

Description number of the data object identifier

= Data Length Count number of the data bytes received received data, (1...8 bytes)

TRUE: further received data available in the FiFo

FALSE: no further data available in the FiFo feedback of the function block

(possible messages → following table)

34990

74

BasicController CR0403

CAN_RX_RANGE

Unit type = function block (FB)

Unit is contained in the library ifm_RawCAN_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35413

>

Description

35368

CAN_RX_RANGE provides the following settings:

 select the message type (11 or 29 bits),

 define an identifier range.

>

CAN_RX filters for the set identifier. If several CAN messages with the same identifier are received in one cycle, only the last / latest message is available.

Parameters of the inputs

35226

Parameter

ENABLE

CHANNEL

ID_START

ID_STOP

Extended

(optional use of the parameter)

Data type

BOOL

BYTE

DWORD

DWORD

BOOL := FALSE

Description

TRUE: execute this function element

FALSE: unit is not executed

> Function block inputs are not active

> Function block outputs are not specified

CAN interface (1...n) depending on the device start number of the data object identifier range: normal frame (2 11 ):

0...2 047 = 0x0000 0000...0x0000 07FF extended frame (2 29 ):

0...536 870 911 = 0x0000 0000...0x1FFF FFFF end number of the data object identifier range: normal frame (2 11 ):

0...2 047 = 0x0000 0000...0x0000 07FF extended frame (2 29 ):

0...536 870 911 = 0x0000 0000...0x1FFF FFFF

TRUE: extended Frame (ID = 0...2

29 -1)

FALSE: normal Frame (ID = 0...2

11 -1)

75

BasicController CR0403

>

Parameters of the outputs

Parameter

ID

DATALENGTHCOUNT

DATA

RESULT

Data type

DWORD

BYTE

ARRAY [0..7] OF BYTE

BYTE

Possible results for RESULT:

Value dec | hex

Description

5

9

0

1

242

00

01

05

09

F2

FB is inactive function block execution completed without error

FB is being processed – still receiving

CAN is not active

Error: setting is not possible

Description

Number of the data object identifier: normal frame (2 048 IDs):

0...2 047 = 0x0000 0000...0x0000 07FF extended Frame (536 868 864 IDs):

2 048...536 870 911 = 0x0000 0800...0x1FFF FFFF

= Data Length Count number of the data bytes received received data, (1...8 bytes) feedback of the function block

(possible messages → following table)

34989

76

BasicController CR0403

CAN_RX_RANGE_FIFO

= CAN RX range with FiFo

Unit type = function block (FB)

Unit is contained in the library ifm_RawCAN_NT_Vxxyyzz.LIB

Symbol in CODESYS:

35066

>

Description

CAN_RX_RANGE_FIFO basically works like CAN_RX_RANGE

(→ p. 75 ).

In addition, CAN_RX_RANGE_FIFO provides a FiFo for the received data. Thus several CAN messages can be received in one cycle.

No overwriting takes place when the FiFo is full. Inbound messages will be lost.

>

In this event:

► Use ENABLE to deactivate and reactivate the function.

> The FiFo is deleted and can be newly filled.

Parameters of the inputs

Parameter

ENABLE

CHANNEL

ID_START

ID_STOP

Extended

(optional use of the parameter)

Data type

BOOL

BYTE

DWORD

DWORD

BOOL := FALSE

Description

TRUE: execute this function element

FALSE: unit is not executed

> Function block inputs are not active

> Function block outputs are not specified

CAN interface (1...n) depending on the device start number of the data object identifier range: normal frame (2 11 ):

0...2 047 = 0x0000 0000...0x0000 07FF extended frame (2 29 ):

0...536 870 911 = 0x0000 0000...0x1FFF FFFF end number of the data object identifier range: normal frame (2 11 ):

0...2 047 = 0x0000 0000...0x0000 07FF extended frame (2 29 ):

0...536 870 911 = 0x0000 0000...0x1FFF FFFF

TRUE: extended Frame (ID = 0...2

29 -1)

FALSE: normal Frame (ID = 0...2

11 -1)

35370

35226

77

BasicController CR0403

>

Parameters of the outputs

Parameter

ID

DATALENGTHCOUNT

DATA

MORE_DATA_AVAILABLE

RESULT

Data type

DWORD

BYTE

ARRAY [0..7] OF BYTE

BOOL

BYTE

Possible results for RESULT:

Value dec | hex

Description

5

9

0

1

242

250

00

01

05

09

F2

FA

FB is inactive function block execution completed without error

FB is being processed – still receiving

CAN is not active

Error: setting is not possible

Error: FiFo is full – data was lost

Description

Number of the data object identifier: normal frame (2 048 IDs):

0...2 047 = 0x0000 0000...0x0000 07FF extended Frame (536 868 864 IDs):

2 048...536 870 911 = 0x0000 0800...0x1FFF FFFF

= Data Length Count number of the data bytes received received data, (1...8 bytes)

TRUE: further received data available in the FiFo

FALSE: no further data available in the FiFo feedback of the function block

(possible messages → following table)

34984

78

advertisement

Related manuals

Download PDF

advertisement

Table of contents