-
Notifications
You must be signed in to change notification settings - Fork 15
/
Program.cs
65 lines (52 loc) · 2.18 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
* Created by SharpDevelop.
* User: Stefan Roßmann
* Date: 10.05.2013
* Time: 16:05
*/
using System;
using System.Collections;
namespace EasyNetVars
{
class Program
{
public static void Main(string[] args)
{
NetVars srCodesysWriteVars = null;
NetVars srCodesysNetVars = null;
srCodesysWriteVars = new NetVars();
srCodesysWriteVars.IPAdress = "192.168.178.34";
srCodesysWriteVars.CobID = 2;
CDataTypeCollection collect;
//srCodesysWriteVars.Port = 1203;
collect = new CDataTypeCollection(-35, EasyNetVars.DataTypes.inttype);
collect.VariableName = "rcvInt";
srCodesysWriteVars.dataTypeCollection.Add(collect);
collect = new CDataTypeCollection(0.123, EasyNetVars.DataTypes.realtype);
collect.VariableName = "rcvReal";
srCodesysWriteVars.dataTypeCollection.Add(collect);
collect = new CDataTypeCollection(0x1010, EasyNetVars.DataTypes.wordtype);
collect.VariableName = "rcvWord";
srCodesysWriteVars.dataTypeCollection.Add(collect);
collect = new CDataTypeCollection(true, EasyNetVars.DataTypes.booltype);
collect.VariableName = "rcvBool";
srCodesysWriteVars.dataTypeCollection.Add(collect);
for (int i = 0; i < 300; i++)
{
collect = new CDataTypeCollection(123, EasyNetVars.DataTypes.bytetype);
srCodesysWriteVars.dataTypeCollection.Add(collect);
}
//---nur für Konfiguration SPS erforderlich?
srCodesysWriteVars.CreateGVLFile("c:\\GVLFile.GVL");
srCodesysWriteVars.SendValues();
srCodesysNetVars = new NetVars();
srCodesysNetVars.Port = 1204;
srCodesysNetVars.IPAdress = "192.168.178.34";
for (int i = 0; i < 514; i++)
srCodesysNetVars.dataTypeCollection.Add(new CDataTypeCollection(EasyNetVars.DataTypes.bytetype));
ArrayList ReceiveVar = srCodesysNetVars.ReadValues();
Console.WriteLine(ReceiveVar[513].ToString());
Console.ReadKey();
}
}
}