User Tools

Site Tools


faq20

SCADA software LAquis FAQ | SCADA software

Question: How to communicate SCADA LAquis with Arduino?

Answer:

Create a communication protocol serial or ethernet. Define frames in Arduino, bytes to send and receive data to it. Then create a driver.

Serial 3 steps example:

1/3 - Create a communication protocol in Arduino, example:

int valuearray[100]; // Array of values
 
void setup() { 
 //Initialize serial and wait for port to open:
  Serial.begin(9600); 
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB
  }
} 
 
 
void loop() {
 int node;
 int command;
 int address;
 int value;
        // send data only when you receive data:
        if (Serial.available() > 0) {
 
                // read the incoming byte:
                 node = Serial.read();
                 command = Serial.read();
                 address = Serial.read();
 
                 if (node == 1) {
                  if (command == 1 ) {
                    value = valuearray[address];
                  } else
                  if (command == 2 ) {
                    value = Serial.read();
                    valuearray[address] = value;
                  }
 
                    Serial.write(node);
                    Serial.write(command);
                    Serial.write(address);
                    Serial.write(value);
                 }
 
 
 
 
        }
 
}

2/3 - Then create a driver in LAquis using c:\Program Files(x86)\LAquis\editorldriver.exe:

// Param1 = address
// Param2 = node
ldriver 3.0
:TimeOutBytes=100
:Try=3
:CacheTimeOut=1000
:Hold=0
 
?Comando=1 //Read
>node 1 address
<node 1 address *value
.
 
?Comando=2 //Write
:CacheTimeOut=0
>node 1 address value
<node 1 address value
.

3/3 - Save this driver as Example.ldriver. In LAquis select driver - Example - Config select serial port. In Param1 type and address from 0 to 99. In Param2 type node address 1. In Sampling column type 1s. Click to test in button Play.

faq20.txt · Last modified: 2016/10/24 13:18 by scadalaquis

Page Tools


Tags: SCADA software , SCADA systems.