Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
SYPT PRO User Guide / SYPT PRO User Guide.doc
Скачиваний:
244
Добавлен:
03.03.2016
Размер:
17.32 Mб
Скачать

SpGateway - ctNet to fieldbus gateway

SPGateway can be used in a Unidrive SP when it being used as a gateway between a fieldbus and CTNet. It allows the fieldbus PLC to gain non-cyclic access to any parameter in any node on the CTNet network, including all parameters in the local Unidrive SP. It is modelled on the PPO 4 Word non-cyclic data mode available on all SM-xxxx fieldbus modules, and PLC code that has been written to implement PPO 4 Word non-cyclic data can be used with SPGateway to access any parameter on the CTNet network.

4 IN and 4 OUT words of fieldbus cyclic data need to be reserved for SPGateway. 2 words are used to specify the control, CTNet node address, menu and parameter, with the remaining 2 words used to send the data to be written, or return the data value read from the target parameter.

Arguments

Ctrl%

Bitmapped control word for the next CTNet message.

The fieldbus mappings should be configured to map 4 OUT and 4 IN data words to two 32-bit PLC registers in the SM-Applications, and use these registers as the input and output arguments for SPGateway. WaitT% can be constant, or it can be picked up from a local Unidrive SP parameter, allowing it to be adjusted by writing to the relevant parameter in the Unidrive SP.

(_S14%, _S15%) = SPGateway(_R14%, _R15%, 200)

Note:

to read parameters in the Unidrive SP that is acting as a gateway, simply specify the CTNet node address being used by the SM-Applications.

SPGateway is controlled using the control byte (bits 31-24) in the Ctrl% input argument. The control byte specifies which type of message is required with the remainder of Ctrl% specifying the CTNet node and target parameter to be read from or written to. Data value is required for WRITE messages, and is a signed 32-bit value.

DataI%

Data values for a write message.

WaitT%

Maximum length of time (in milleseconds) to wait for a response from the target node before returning a timeout error.

Return Values

Stat%

Status word for the last completed CTNet message. The current status of the SPGateway can be checked using the status byte of this output.

The TOGGLE_IN and TOGGLE_OUT bits are needed when the PLC scan time (or fieldbus update time) is slower than the CTNet message time. SPGateway may set the ACTIVE bit to 1, complete the CTNet message, and ACTIVE bit to 0 between PLC scans or fieldbus update cycles, so the change in ACTIVE bit will not be detected in the PLC. In this case, for a READ message, the PLC would not know if DataO contains the old data value, or the new data value from the current message.

TOGGLE_OUT is only updated when the CTNet message has been completed. Therefore, when TOGGLE_OUT = TOGGLE_IN, the PLC knows that the requested message has been completed, and DataO has the value of the requested parameter.

DataO%

For a successful read/write message, returns the data value read from, or written to, the target parameter. If an error occurred DataO% will contain the error code indicating why the message failed. See table below for error codes.

To use SPGateway with older 16-bit PLCs, the Ctrl, DataI, Stat and DataO arguments must be split into 16-bit words. This does not affect the data transfer over the fieldbus, provided the correct words are configured in the PLC. 16-bit data and 32-bit data is simply a function of how the data bytes are interpreted at each end of the fieldbus.

When configuring the PROFIBUS-DP in the PLC, the "PPO 4 Word" should be used. Consistency is essential to ensure that all 4 words are updated on PROFIBUS at the same instant. Failure to ensure this could result in the wrong value being written to the wrong parameter under certain circumstances.

The steps for implementing a message are:

1. For a WRITE message, load DataI with the data value that must be written. (DataI should be set to 0 for a READ message as this will make it easier to check that a new data value has been received.)

2. Set node address, menu and parameter to required values.

3. Invert TOGGLE_IN, and set CONTINUOUS bit as required.

4. Finally, set READ or WRITE bit to 1.

5. ACTIVE bit will be set to indicate that the message is in progress.

6. When the message is complete, TOGGLE_OUT will be set to the same value as TOGGLE_IN, and the SUCCESS or ERROR bits will be set. Node address, menu and parameter specified in Ctrl will also be mirrored in Stat.

7. If SUCCESS is set to 1, the message was successful. For a READ message, DataO contains the value returned from the target parameter. For a WRITE message, DataO contains the value written successfully to the target parameter.

8. If ERROR is set to 1, the message returned an error. DataO will contain a status code to indicate the reason why the message failed.

Target/ Language Restrictions

Only available on SM-Applications.

________________________________________________________________________________