Deutschmann Automation GmbH & Co. KG
Ethernet
Script example for the initialization of the Ethernet
var wRemotePort: word; Moveconst(wRemotePort, 2001);
var wLocalPort: word; Moveconst(wLocalPort, 2000);
var lRemoteIP: long; Moveconst(lRemoteIP, 0xc0a82f0b); // 192.168.47.11
var lE3: long; Moveconst(lE3, 0xE3222222); // Channel 0 connected, rest
unused
var w0: word; Moveconst(w0, 0);
var bChannel: byte; Moveconst(bChannel, 0);
var lBusState: long;
var wInCount: word;
var wOutCount: word;
var aRecvData: buffer[100];
var aSendData: buffer[100];
// Initialize channel 0 as TCP-Client
InitFastEthernet(bChannel, TCPIP_Client, wRemotePort, wLocalPort, lRe-
moteIP);
BusStart; // activateEthernet
:waitForConnection;
//
Check
TCP
connection,
wait
if
necessary
(unnecessary for UDP)
Get(ReadBusState, lBusState);
if lBusState equal lE3 then :connected;
jump :waitForConnection;
:connected; // Check for reception when connected
Get(AvailableBusData, wInCount);
if wInCount equal w0 then :send; // read and evaluate on receipt
ReadBus(aRecvData[0], wInCount);
{add code here to evaluate reception}
:send; // send something
Moveconst(wOutCount, 13);
Moveconst(aSendData[0], "Sende data...");
WriteBus(aSendData[0], wOutCount);
jump :waitForConnection; // typically scripts run as endless loop
®
3.4.20
Instruction manual UNIGATE
IC2 - Fast Ethernet V. 1.2
38
Need help?
Do you have a question about the UNIGATE IC2 - Fast Ethernet and is the answer not in the manual?