-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
47 lines (34 loc) · 801 Bytes
/
main.cpp
File metadata and controls
47 lines (34 loc) · 801 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include "OPCClient.h"
#include "Opcda.h"
#include "opccomn.h"
#include "OpcEnum.h"
#include <comdef.h>
#include <string>
#include <sstream>
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main()
{
_bstr_t items[] = {"tag001","tag002"};
_bstr_t items2[] = {"tag200", "tag198"};
int indice[] = {0,1},x=1;
OPCClient Teste;
OPCClient Teste2;
//Teste.OPCConnect("RSLinxRemote OPC Server");
Teste.OPCConnect("ElipseSCADA.OPCSvr.1");
Teste.InsertItens(items, 2);
Teste2.OPCConnect("ElipseSCADA.OPCSvr.1");
Teste2.InsertItens(items2, 2);
Teste.Show(3);
Sleep(1000);
while(1)
{
_variant_t valores[]= {x,x};
Teste2.WriteItens(indice,valores,2);
Teste2.Show(1);
x++;
cout<<endl;
}
}