Description

An Enable Disable HTTP or FTP/TFTP Services operation changes the enabled state of the module’s HTTP or FTP/TFTP services.

Network Implementation

An Enable Disable HTTP or FTP/TFTP Services operation can be performed on TCP/IP Ethernet networks.

Implementing the DATA_EXCH Block

A DATA_EXCH block can be used to change the state of the FTP/TFTP service or the HTTP service while the application is running. The DATA_EXCH block cannot change the state of the HTTP or FTP/TFTP services if the service was disabled using one of the configuration tools.

NOTE: It is although recommended to use the ETH_PORT_CTRL EFB instead of DATA_EXCH function to manage security on M340 and M580.
NOTE: Ethernet services of the embedded port of M580 can not be modified using the DATA_EXCH block. To do this, use the ETH_PORT_CTRL block.

Configuring the Address Variable

The Address variable identifies the local address of the module for which FTP/TFTP and HTTP will be enabled or disabled

Variable

Type

Description

Address

ARRAY [0..5] of INT for Premium

ARRAY [0..7] of INT for M340

Address of the destination entity of the exchange. If the Action parameter is send/receive type, broadcast addresses are prohibited.

For Premium:

  • Use the ADDR function.

  • Example: ADDR( ‘0.4.0.SYS’ )

For M340:

  • Use the ADDM function.

  • The destination entity of the exchange is an array of 8 words.

  • Example: ADDM( '0.4.0' )

NOTE: In each example, the address is:
  • rack = 0

  • slot = 4

  • channel = 0

Configuring the Action Variable

The Action variable identifies the function type for the DATA_EXCH function block:

Variable

Type

Description

Value (hex)

Action

INT

1 = Transaction followed by await reception

16#0001

Configuring the Data_to_Send Variable

The Data_to_Send variable is an ARRAY [0..3] of INT and includes the following:

Variable

Description

Value (hex)

Data_to_Send[0]

  • High byte = 16#00

  • Low byte = request code (16#5A)

16#005A

Data_to_Send[1]

  • High byte = 16#01

  • Low byte = subrequest code (16#6E)

16#016E

Data_to_Send[2]

  • Low byte = Ethernet service command (16#xx) on M340/M580. 16#00 on Premium

  • High byte = Ethernet service command (16#xx) on Premium. 16#00 on M340/M580

The values of the Ethernet service command can be:

  • 16#00 - No change

  • 16#01 - Enable FTP only

  • 16#02 - Disable FTP only

  • 16#10 - Enable HTTP only

  • 16#20 - Disable HTTP only

  • 16#11 - Enable FTP; Enable HTTP

  • 16#12 - Enable HTTP; Disable FTP

  • 16#21 - Disable HTTP; Enable FTP

  • 16#22 - Disable FTP; Disable HTTP

16#00xx on M340/M580

16#xx00 on Premium

Data_to_Send[3]

  • High byte = Reserved (16#00)

  • Low byte = Reserved (16#00)

16#0000

Configuring the Management_Param Variable

The Management_Param variable is an ARRAY [0..3] of INT and includes the following:

Variable

Description

Value (hex)

Management_Param[0]

  • High byte = Exchange number, filled by the system

  • Low byte = Activity bit, filled by the system

-

Management_Param[1]

-

Management_Param[2]

The time out value can be set to any value. Because the time-out base is 100 ms, in this example the time-out is set to 10 seconds.

16#0064

Management_Param[3]

  • High byte = Length (16#00)

  • Low byte = Length (16#08)

NOTE: The Length needs to be set to a value of 8 bytes.

16#0008

Viewing the Response

Use a Control Expert Animation Table to display the response. The response is contained in the Received_Data variable, which is an ARRAY [0..3] of INT:

Variable

Value (hex)

Example of a successful response:

Received_Data[0]

16#005A (M340 Modbus)

16#008A (Premium UNITE)

Received_Data[1]

16#xxFE (Success)

Received_Data[2]

16#00yy

NOTE: The word created with the 16#yyxx has got the same meaning as ETH_SCE_STATUS output of ETH_PORT_CTRL EFB.

Received_Data[3]

16#0000

Example of an unsuccessful response:

Received_Data[0]

16#005A (M340 Modbus)

16#008A (Premium UNITE)

Received_Data[1]

16#xxFD (Detected error)1

Received_Data[2]

16#00xx1

Received_Data[3]

16#0000

1. The detected error code appears in the format FD xx xx, where xx xx can be the following:

  • 50 86: Busy: When the request occurs with 2 seconds of the previous request, regardless of the previous request success or detected error.

  • 40 01: Same State: When the request is called to change the sate of both HTTP and FTP/TFTP to their currently existing state.

  • 20 04: Invalid Data: When the data in the request is not in the form specified by the request type.

  • 50 69: Disabled: When FTP/TFTP or HTTP is already disabled by Control Expert and the request attempts to change the state of the disabled service.

NOTE: In case of multiple detected errors, the order of priority in the display is Disabled, Invalid Data, Same State, Busy.