Free Protocol Ethernet Driver Purge of Port

Free Protocol Ethernet Driver Purge of Port
none 0.0 0

Is there a purge instruction for the free protocol ethernet driver? The purge I see in the manual pertains to the serial port.
How do you purge an ethernet port?


Hi @SteveV,

There is no PURGE command for the Ethernet port, but it is possible to “clear” a set number of bytes by performing an INPORT into an unused variable. Here is an example:

sub ePurge()
	char g[255]
	short len = 0
	INPORT(g[0], "Free Protocol Server (Ethernet)", 255, len)
end sub

macro_command main()
	char a[32] 
	short receive_len = 0
	bool on = true, off = false
	ePurge() // "clear" last 255 bytes of data on eth port 
	FILL(a[0], 0, 32)
	DELAY(1000) // wait one second
	INPORT(a[0], "Free Protocol Server (Ethernet)", 32, receive_len)
	if receive_len > 0 then
		SetData(a[0], "Local HMI", LW, 0, 32)
		SetData(on, "Local HMI", LB, 0, 1)
	end if
end macro_command