Safe_SDG_Producer (FB)ΒΆ

FUNCTION_BLOCK Safe_SDG_Producer

Safe_SDG_Producer does produce a J1939 Safety SDG supposed to be send via a J1939SafetyStd.Unsafe_SDG_Sender.

The inputs S_usiSHMPriority, S_usiSDMPriority, S_dwPGN, S_tTransmissionRate and S_usiSrcAddr get sampled at xEnable rising edge.
The inputs S_abyData and S_usiDataLength can be set any time.

For an overview of general data flow view see the library main documentation and the J1939 Safety example.project.

InOut:

Scope

Name

Type

Initial

Comment

Input

xEnable

BOOL

FALSE

Enable SDG production.
The inputs S_usiSHMprio, S_usiSDMprio, S_PGN, S_usiSrcAddr and S_tRefreshTime are sampled with a rising edge.

S_usiSHMPriority

SAFEUSINT (0..J1939_CONSTANTS.usiMAX_PRIORITY)

1

SHM send priority:
0-7: priority (0: high, 7: low)
Note: The SHM priority shall be a value with the same or higher priority (lower value) as the SDM priority.

S_usiSDMPriority

SAFEUSINT (0..J1939_CONSTANTS.usiMAX_PRIORITY)

1

SDM send priority:
0-7: priority (0: high, 7: low);

S_dwPGN

DWORD

0

Parameter Group Number (PGN).

S_tTransmissionRate

TIME

TIME#0ms

Transmission rate to send the SDG data.

S_usiSrcAddr

USINT

0

Source Address.

S_abyData

ARRAY [0..(J1939_CONSTANTS.usiSDM_MAX_DATALENGTH - 1)] OF SAFEBYTE

[0, 0, 0, 0, 0, 0, 0, 0]

SDG data to transmit.

S_usiDataLength

SAFEUSINT (0..J1939_CONSTANTS.usiSDM_MAX_DATALENGTH)

0

Length of SDG data to transmit.

Output

S_xBusy

BOOL

FALSE

In operation.

S_xError

BOOL

FALSE

Error occured.

S_eErrorID

ERROR

ERROR.NO_ERROR

Error status.

S_SDGS

J1939SafetyItf.SAFETY_DATA_GROUP_SAFE

SDG data to be send by a J1939SafetyUnsafe.Unsafe_SDG_Sender.