Updated Home (markdown)

FalcoGoodbody
2020-09-15 09:26:31 +02:00
parent 75966122b1
commit 4aade10dc8

16
Home.md

@@ -301,8 +301,8 @@ public void Plc.ReadMultibleVars(List<DataItem> dataItems);
Example: this method reads several variables from a data block Example: this method reads several variables from a data block
define the data items first
```csharp ```csharp
// define the data items first
private static DataItem varBit = new DataItem() private static DataItem varBit = new DataItem()
{ {
DataType = DataType.DataBlock, DataType = DataType.DataBlock,
@@ -368,19 +368,23 @@ private static DataItem varDateTime = new DataItem()
StartByteAdr = 138, StartByteAdr = 138,
Value = new object() Value = new object()
}; };
```
// define a list where the DataItems will be stored in Then define a list where the DataItems will be stored in
```csharp
private static List<DataItem> dataItemsRead = new List<DataItem>(); private static List<DataItem> dataItemsRead = new List<DataItem>();
```
// add the DataItems to the list add the data items to the list
```csharp
dataItemsRead.Add(varBit); dataItemsRead.Add(varBit);
dataItemsRead.Add(varByteArray); dataItemsRead.Add(varByteArray);
dataItemsRead.Add(varInt); dataItemsRead.Add(varInt);
dataItemsRead.Add(varReal); dataItemsRead.Add(varReal);
dataItemsRead.Add(varString); dataItemsRead.Add(varString);
dataItemsRead.Add(varDateTime); dataItemsRead.Add(varDateTime);
```
// open the connection to the plc open the connection to the plc and read the items at once
```csharp
myPLC.Open(); myPLC.Open();
// read the list of variables // read the list of variables