-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWriteSnap.cpp
More file actions
30 lines (27 loc) · 978 Bytes
/
WriteSnap.cpp
File metadata and controls
30 lines (27 loc) · 978 Bytes
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
#include <iostream>
#include "WriteSnap.h"
#include "s7.h"
bool writeValuesToPLC_2(TS7Client* Client, byte* MyDB35, int* writeIntValues, float* writeRealValues, int IntArraySize, int RealArraySize, int writeStart, int writeSize, int DB_NUMBER)
{
// Prepare buffer with array of ints and reals
//for (int i = 0; i < IntArraySize; ++i)
//{
// S7_SetIntAt(MyDB35, i * 2, writeIntValues[i]);
//}
//for (int i = 0; i < RealArraySize; ++i)
//{
// S7_SetRealAt(MyDB35, (IntArraySize * 2) + (i * 4), writeRealValues[i]);
//}
// Write array of ints and reals to DB
int result = Client->WriteArea(S7AreaDB, DB_NUMBER, writeStart, writeSize, S7WLByte, MyDB35);
if (result == 0)
{
//std::cout << "Successfully wrote values to PLC." << std::endl;
return true;
}
//else
//{
// std::cout << "Failed to write to PLC. Error: " << CliErrorText(result) << std::endl;
// return false;
//}
}