FP_IPV4_GET_MAC

获取MAC地址的参数

此FP指令将读取以太网连接使用的MAD地址并将值写入DUT FP_IPv4_MAC_DUT

参数

输出

dutIPv4MAC (FP_IPv4_MAC_DUT)

MAC地址的参数

示例

POU头

所有用于编程此函数的输入和输出变量已在POU头中声明。 所有编程语言使用相同的POU头。

	VAR
		bSetIpv4Address: BOOL:=FALSE;
		bGetConnection: BOOL:=FALSE;
		bGetMac: BOOL:=FALSE;
		dutIPv4Connection: FP_IPv4_CONNECTION_DUT;
		dutIPv4MAC: FP_IPv4_MAC_DUT;
	END_VAR

POU本体

此示例设置由s_Address指定的以太网连接参数。 请确保也在[系统寄存器(Y)] > [以太网] > [用户连接]下的项目导航中设置合适的参数。 bGetConnection设置为TRUE时,连接参数将输入到DUT FP_IPv4_CONNECTION_DUT bGetMac设置为TRUE时,MAC地址的参数将输入到DUT FP_IPv4_MAC_DUT

LD本体

BODY
    WORKSPACE
        NETWORK_LIST_TYPE := NWTYPELD ;
        ACTIVE_NETWORK := 0 ;
    END_WORKSPACE
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 5 ;
        NETWORK_BODY
B(B_VARIN,,'IP=192.168.1.5~MASK=255.255.255.0~GWIP=192.168.1.1',29,3,31,5,);
B(B_CONTACT,,bSetIpv4Address,4,2,6,4,R);
B(B_CONTACT,,sys_bIsEthernetInitializing,15,2,17,4,);
B(B_VAROUT,,bError,43,3,45,5,);
B(B_F,FP_IPV4_SET_ADDRESS!,,31,1,43,5,,?DEN?DsAddress?AENO?CbError);
L(1,3,4,3);
L(6,3,15,3);
L(17,3,31,3);
L(1,0,1,5);
        END_NETWORK_BODY
    END_NET_WORK
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 6 ;
        NETWORK_BODY
B(B_VAROUT,,dutIPv4Connection,45,3,47,5,);
B(B_CONTACT,,bGetConnection,4,2,6,4,);
B(B_F,FP_IPV4_GET_CONNECTION!,,31,1,45,5,,?DEN?DnPort?AENO?CdutIPv4Connection);
B(B_VARIN,,SYS_ETHERNET_USER_CONNECTION_2,29,3,31,5,);
B(B_CONTACT,,sys_bIsEthernetIPAddressAssigned,15,2,17,4,);
L(6,3,15,3);
L(17,3,31,3);
L(1,3,4,3);
L(1,0,1,6);
        END_NETWORK_BODY
    END_NET_WORK
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 4 ;
        NETWORK_BODY
B(B_CONTACT,,bGetMac,4,1,6,3,);
B(B_F,FP_IPV4_GET_MAC!,,31,0,41,4,,?DEN?AENO?CdutIPv4MAC);
B(B_VAROUT,,dutIPv4MAC,41,2,43,4,);
L(1,2,4,2);
L(6,2,31,2);
L(1,0,1,4);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST本体

IF DF(bSetIpv4Address) AND sys_bIsEthernetInitializing then
    FP_IPV4_SET_ADDRESS(sAddress := 'IP=192.168.1.5,MASK=255.255.255.0,GWIP=192.168.1.1',
				bError => bError);
END_IF;
IF (bGetConnection) then
    FP_IPV4_GET_CONNECTION(nPort := SYS_ETHERNET_USER_CONNECTION_2, dutIPv4Connection => dutIPv4Connection);
END_IF;
IF (bGetMac) then
    FP_IPV4_GET_MAC(dutIPv4MAC => dutIPv4MAC);
END_IF;

最后更新日期: 2022-04-05此页面上的反馈松下热线