LWORD_TO_MACADDR

Converts the binary data of type LWORD to type ETHERNET_ADDRESS. The LWORD bytes are converted and swapped during conversion according to the following scheme: The least significant byte becomes the last and the most significant converted byte becomes the first octet of the MAC address.

Namespace: Tc3_Collections
Library: Tc3_Collections (Tc3_Collections.compiled-library)

FUNCTION LWORD_TO_MACADDR : ETHERNET_ADDRESS
VAR_INPUT
    in: LWORD(0..16#FFFFFFFFFFFF);
END_VAR

LWORD_TO_MACADDR 1: Inputs

Name

Type

Description

in

LWORD(0..16#FFFFFFFFFFFF)

The LWORD value to be converted.

LWORD_TO_MACADDR 2: Return value

Name

Type

Description

LWORD_TO_MACADDR

ETHERNET_ADDRESS

Octet string with the maximum length of 8 octets.

Example

METHOD FINAL Sample_LWORD_TO_MACADDR : BOOL
VAR
    mac: ETHERNET_ADDRESS;
END_VAR
mac:=LWORD_TO_MACADDR(16#00B0D063C226);
(* mac:=00-B0-D0-63-C2-26 *)
Sample_LWORD_TO_MACADDR:=TRUE;