-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReadSnap.cpp
More file actions
31 lines (29 loc) · 1.06 KB
/
ReadSnap.cpp
File metadata and controls
31 lines (29 loc) · 1.06 KB
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
#include <iostream>
#include "ReadSnap.h"
#include "s7.h"
bool readValuesFromPLC_2(TS7Client* Client, byte* MyDB35, int IntArraySize, int RealArraySize, int readStart, int readSize, int DB_NUMBER)
{
// Read array of ints and reals from DB
int result = Client->ReadArea(S7AreaDB, DB_NUMBER, readStart, readSize, S7WLByte, MyDB35);
if (result == 0)
return true;
//{
// std::cout << "Integer values:" << std::endl;
// for (int i = 0; i < IntArraySize; ++i)
// {
// int value = S7_GetIntAt(MyDB35, i * 2);
// std::cout << "Value[" << i << "] = " << value << std::endl;
// }
//std::cout << "Real values:" << std::endl;
// for (int i = 0; i < RealArraySize; ++i)
// {
// float value = S7_GetRealAt(MyDB35, (IntArraySize * 2) + (i * 4));
// // std::cout << "RealValue[" << i << "] = " << value << std::endl;
// }
// return true;
//}
//else
//{
//std::cout << "Failed to read from PLC. Error: " << CliErrorText(result) << std::endl;
//}
}