Change Ip Adress and Date/Time of the Core through the PLC

Hello,

Is it possible to change the Ip adress of the XF51 port and the date/time of the Core through the PLC?

Many thanks,

Best reply by CodeShepherd

At the moment changing them is only possible via the REST API named "ctrlX CORE - Connectivity API" and "ctrlX CORE - System API" via https communication. So could implement a corresponding library and do the requests as described in our Swagger documentation that can be found on your ctrlX CORE WebUI:

ctrlX CORE WebUI API references Connectivity and System

See also the blog post "Using the REST API of ctrlX CORE [DOCU] - [VIDEO]" in our ctrlX AUTOMATION Community for some general information.

You can add dynamic IP addresses via the "SysSocket_Implementation" library:

Declaration:

 

PROGRAM PLC_PRG
VAR
	IPAdress: SysSocket_Implementation.INADDR;
	NetMask: SysSocket_Implementation.INADDR;
	AdapterName: WSTRING := "eth0";
	bSetIP: BOOL;
END_VAR

 

Implementation:

 

If bSetIP then
	bSetIP := FALSE;	
	AdapterName;	
	IPAdress.S_un_b.s_b1 := 192;
	IPAdress.S_un_b.s_b2 := 168;
	IPAdress.S_un_b.s_b3 := 0;
	IPAdress.S_un_b.s_b4 := 55;	
	NetMask.S_un_b.s_b1 := 255;
	NetMask.S_un_b.s_b2 := 255;
	NetMask.S_un_b.s_b3 := 255;
	NetMask.S_un_b.s_b4 := 0;
	
	SysSockSetIpAddressAndNetMask(wsAdapterName:= AdapterName, IpAddr:= IPAdress, NetMask:= NetMask);	
END_IF

 

View original
1 reply