User guide

64
VTB USER GUIDE
customized protocols.
SET_IP
Sets the parameters of TCP/IP protocol.
Hardware NG35,NGMEVO
Syntax
SET_IP(ip as *char, sm as *char, gw as *char)
Parameters
ip IP address of the device
sm subnet mask
gw gateway
Example
Set_ip(“10,0,0,15”,”255,255,255,0”,0) 'IP = 10,0,0,15
'SUBNET = 255,255,255,0
'GATEWAY = nothing
WARNING: This function must be called in the INIT section of the MAIN or PLC TASK.
PXETH_ADD_PROT
Adds a custom protocol to a specific port of TCP/IP. A custom function to process the new protocol must be written
and its pointer must be pass to this function.
Hardware NG35,NGMEVO
Syntax
PXETH_ADD_PROT(port as long, fun as delegate)
Parameters
port TCP port on which the new protocol is added
fun Pointer to the custom process function
Example
Used variables:
fun delegate
Init section of main:
Set_ip(“10,0,0,15”,0,0) 'set IP = 10,0,0,15
fun=my_protocol
pxeth_add_prot(502,fun) 'Add the protocol my_protocol on port 502
'protocol process function
function my_protocol(len as long, buftx as *char) as long
...
endfunction