# VijeoDesigner 6.2 modbus IP reading script error

#### Notepas

Hello,

I am using VijeoDesigner 6.2 SP10.
I try to read Modbus IP using this script:

Code:
int [] data = ModbusEquipment01.getProperty( "Con_IPAddress" );
for( int i = 0; i < data.length; i++ )
{
}
and I get this error:
Error S8037: [Switch05- Script] [Line:3] Type "Tag.INTEGER" is not an array type
Variable IPaddr Data Type is INT, I try to use different data types, but the error still remains.

There could be a problem?

#### agr

You appear to be trying to write the entire data array into IPaddr and don't appear to be using the index i anywhere
Variable IPaddr need to be defined as an array of 4 integers

Then correct syntax would be
Code:
int [ ] data = ModbusEquipment01.getProperty( "Con_IPAddress" );
for( int i = 0; i < data.length; i++ )
{
}
Moderators note : Please use code tags for pieces of code

#### Notepas

Thank you @agr , then I defined IPaddr as an array of 4 integers, the script do not have anymore errors, but when I am trying to run the script I get the error whitch you can see bellow:

As I understood, with this script I should read ModbusEquipment01 IP address, in this case, it should be 10.10.2.247

#### agr

Thank you @agr , then I defined IPaddr as an array of 4 integers, the script do not have anymore errors, but when I am trying to run the script I get the error whitch you can see bellow:
View attachment 790

As I understood, with this script I should read ModbusEquipment01 IP address, in this case, it should be 10.10.2.247
View attachment 791

sorry forgot to make the change to the script after cut/paste.

You are not specifying the index in the data write

#### Notepas

Yes, I found a mistake, and I change the last row to:
Code:
   IP.IPaddr[i].write( data[i] );
But still I have an error:

#### agr

I dont understand where your issue could be. I setup a new project and added the script/variables and it works fine?

Attached is a copy of my test project (V6.2 SP8)

#### Attachments

• 22 KB Views: 2

#### Notepas

Thank you, I found my mistake.
I always do "Start device simulation", I think, that's why I get zero.
Using "Start simulation", everything works fine.

#### apps_man

You may already be aware of this but the one (or two) IP addresses assigned to the HMI are easily accessible by using System Varialbles. I use this to display the IP address(es) of the HMI on a screen. Configure a "String Display" object on a screen using the variable "Sys.getInfoString(IP_ADDRESS_1)" or ADDRESS_2. The script you are using is for the connected devices such as PLCs.

Regarding simulation: It is possible to connect the simulator (Start Simulation Build) which "duplicates" the "real HMI" to external devices such as a PLC and also to the Unity Pro simulator to test without hardware.