Weintek FREE PROTOCOL (Ethernet) how to – Support Elsist https://support.elsist.biz/forums/topic/weintek-free-protocol-ethernet-how-to/feed/ Fri, 30 Oct 2026 08:42:08 +0000 https://bbpress.org/?v=2.6.20 it-IT https://support.elsist.biz/forums/topic/weintek-free-protocol-ethernet-how-to/#post-64696 Weintek FREE PROTOCOL (Ethernet) how to https://support.elsist.biz/forums/topic/weintek-free-protocol-ethernet-how-to/#post-64696 Mon, 28 Mar 2022 12:37:29 +0000 Chiara On a the Weintek MT8071ip I can correctly read the data sent from an external TCP client using this macro combined with timing execution :

macro_command main()
char wResponse[20] = ""
short receive_len = 0
short wait_time = 1

//FILL(wResponse[0],0,receive_len)
TRACE("receive_len (A) = %d", receive_len) // Easy diagnoser: ritorna 0, ed è giusto
INPORT(wResponse[0], "Free Protocol Server (Ethernet)", receive_len, wait_time)
TRACE(" receive_len (B) = %d", receive_len) // ritorna sempre 0, anche se sono arrivati dei dati

if receive_len >= 4 then
    SetData(wResponse[0], "Local HMI", LW, 0 , 20)
    TRACE(" receive_len3 = %d", receive_len) // qui non arriverà mai, se receive_lan non cambia valore
end if
end macro_command

Every 5 second this run, but seems that always trigger the SetData(… even if there’s no data at all.
If data are received these would disappear on next execution.
Is there a way to enable a script debugger to check what happen inside the macro?

]]>
https://support.elsist.biz/forums/topic/weintek-free-protocol-ethernet-how-to/#post-64710 Rispondi a: Weintek FREE PROTOCOL (Ethernet) how to https://support.elsist.biz/forums/topic/weintek-free-protocol-ethernet-how-to/#post-64710 Wed, 30 Mar 2022 10:10:39 +0000 Sergio Bertana Non sò dove hai preso le informazioni sull’utilizzo della funzione INPORT, ma la tua macro và scritta in questo modo:

macro_command main()
char Response[20] = ""
short RLength = 20 //Receive length
short CRecvd = 0 //Received characters

//FILL(Response[0],0,RLength)
INPORT(Response[0], "Free Protocol Server (Ethernet)", RLength, CRecvd)

if CRecvd >= 4 then
    TRACE(" CRecvd = %d", CRecvd)
    SetData(Response[0], "Local HMI", LW, 0 , 20)
end if
end macro_command

In pratica definisci la quantità massima di caratteri da leggere in RLength, mentre in CRecvd viene ritornato il numero di caratteri letti.

]]>