ConnectTo

Description

Connects the client to the hardware at (IP, Rack, Slot) Coordinates.

Declaration

int ConnectTo(IPAddress Address, uint16_t Rack, uint16_t Slot);

 

 

Parameters

 

Type

Dir.

 

Address

IPAddress class

In

PLC/Equipment IPV4 Address
ex. 192,168,1,12

Rack

uint16_t

In

PLC Rack number (see below)

Slot

uint16_t

In

PLC Slot number (see below)

 

Return value

         0 : The Client is successfully connected (or was already connected).

         Other values : see the Errors Code List.†

 

Rack and Slot

 

In addition to the IP Address, that we all understand, there are two other parameters that index the unit : Rack (0..7) and Slot (1..31) that you find into the hardware configuration of your project, for a physical component, or into the Station Configuration manager for WinAC.

 

There is however some special cases for which those values ​​are fixed or can work with a default as you can see in the next table.

 

 

Rack

Slot

 

S7 300 CPU

0

2

Always

S7 400 CPU

Not fixed

Follow the hardware configuration.

WinAC CPU

Not fixed

Follow the hardware configuration.

S7 1200 CPU

0

0

Or 0, 1

S7 1500 CPU

0

0

Or 0, 1

WinAC IE

0

0

Or follow Hardware configuration.

 

 

Letís see some examples of hardware configuration:

 

S7 400 Rack

 

 

Rack

Slot

CPU 1

0

4

CPU 2

0

11

 

 

 

 

The same concept for WinAC CPU which index can vary inside the PC Station Rack.

 

 

S7300 Rack

 

 

Rack

Slot

CPU

0

2

 

 

 

 

S7300 CPU is always present in Rack 0 at Slot 2