Actually thats my first time to post here.
i was trying to communicate with my arduino uno using OPC.
i have a problem as below:
first, I need to establish 100 items (to be used and read by SCADA system (wonderware intouch) ) from arduino, i looked in the internet and used the available examples in library. and i succeed to establish and read/write on arduino pins
till now every thing is OK
i tried to increase the OPC items, it worked fine also till i reached approx. 50 items, after that the OPC explorer or web server couldnt communicate with my arduino.
this is my code (which is just a modification on library examples for illustration)
/*
* A generic sketch for use with the Arduino OPC or Visual OPC Builder from www.st4makers.com
*/
#include <OPC.h>
#include <Bridge.h>
#include <Ethernet.h>
#include <SPI.h>
/*
* Declaring the OPC object
*/
OPCEthernet myArduinoUno;
/*
* MAC address from Ethernet shield sticker under board
*/
byte mac[] = { 0x90, 0xA2, 0xDA, 0x0E, 0xAD, 0x8D };
/*
* Set your network configuration
*/
IPAddress ip(192, 168, 1, 25);
IPAddress gateway(192,168,1,2);
IPAddress dns_server(192,168,1,1);
IPAddress subnet(255,255,255,0);
/*
* Server listen port
*/
const int listen_port = 80;
opcOperation digital_status_input[61], analog_status_input[6];
bool readwrite_digital(const char *itemID, const opcOperation opcOP, const bool value)
{
byte port;
port = atoi(&itemID[1]);
if (opcOP == opc_opwrite) {
if (digital_status_input[port] == opc_opread) {
digital_status_input[port] = opc_opwrite;
// pinMode(port,OUTPUT);
}
digitalWrite(port,value);
}
else
{
if (digital_status_input[port] == opc_opwrite) {
digital_status_input[port] = opc_opread;
// pinMode(port,INPUT);
}
return digitalRead(port);
}
}
int readwrite_analog(const char *itemID, const opcOperation opcOP, const int value) {
byte port;
port = atoi(&itemID[1]);
if (opcOP == opc_opwrite) {
if (analog_status_input[port] == opc_opread) {
analog_status_input[port] = opc_opwrite;
// pinMode(port,OUTPUT);
}
analogWrite(port,value);
}
else
{
if (analog_status_input[port] == opc_opwrite) {
analog_status_input[port] = opc_opread;
//pinMode(port,INPUT);
}
return analogRead(port);
}
}
void setup() {
byte k;
for (k=0;k<46;k++) digital_status_input[k] = opc_opread;
for (k=0;k<5;k++) analog_status_input[k] = opc_opread;
/*
* OPC Object initialization
*/
myArduinoUno.setup(listen_port,mac,ip);
myArduinoUno.addItem("D0",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D1",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D2",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D3",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D4",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D5",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D6",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D7",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D8",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D9",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D10",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D11",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D12",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D13",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D14",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D15",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D16",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D17",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D18",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D19",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D20",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D21",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D22",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D23",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D24",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D25",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D26",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D27",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D28",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D29",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D30",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D31",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D32",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D33",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D34",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D35",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D36",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D37",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D38",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D39",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D40",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D41",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D42",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D43",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D44",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D45",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("A0",opc_readwrite, opc_int, readwrite_analog);
myArduinoUno.addItem("A1",opc_readwrite, opc_int, readwrite_analog);
myArduinoUno.addItem("A2",opc_readwrite, opc_int, readwrite_analog);
myArduinoUno.addItem("A3",opc_readwrite, opc_int, readwrite_analog);
myArduinoUno.addItem("A4",opc_readwrite, opc_int, readwrite_analog);
myArduinoUno.addItem("A5",opc_readwrite, opc_int, readwrite_analog);
}
void loop() {
myArduinoUno.processOPCCommands();
}
and this is working fine, as attached photo
when i try to increase the items as below:
/// added to the above code
myArduinoUno.addItem("D45",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D46",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D47",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D48",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D49",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D50",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D51",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D52",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D53",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D54",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D55",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D56",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D57",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D58",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D59",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("D60",opc_readwrite, opc_bool, readwrite_digital);
myArduinoUno.addItem("A5",opc_readwrite, opc_int, readwrite_analog);
}
void loop() {
myArduinoUno.processOPCCommands();
}
the OPC server couldnt start or get items as attached photo
so, my question why this happened ? is there any limitations for items quantities ?
Thanks in advance