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

Writenet

WriteNet allows a DPL progam to write a value to a parameter in another CTNet node using non-cyclic data from any task in the DPL program. The WRNET command is used with WaitCode% set to 0, and all other code required to generate a time-out and handle the response is included.

The benefit of using WriteNet is that a task does not stop while waiting for a response from a the remote, allowing the UD70, MD29 or SM-Applications to continue with other tasks while waiting for a reply.

Arguments

Node% - 0 to 255

The destination CTNet node address. 0 will broadcast to all nodes on the CTNet network.

Param% - 0 to 9999

Specifies the parameter to be written to, in the format MMPP, e.g. 1820 means #18.20.

Value% - Signed 32-bit

The value to be written to the target parameter.

Dpos% - -1 to 3

Number of decimal places.

WaitT% - 16 to 65535

Time period (in ms) to wait for a response before abandoning the message. If the time specified is less than 16ms, it will be clamped internally to 16ms.

Ctrl% - 0 to 3

The control word.

Return Values

Stat%

This returns the status of the operation/ request..

Error%

The error code if an error is indicated by the Stat% output.

The steps for implementing a message are:

1. Set target node address, target parameter reference, data value to be written, number of decimal places and timeout period.

2. Set ENABLE and WRITE bits to 1.

3. When Stat goes to ACTIVE, reset WRITE bit to 0.

4. If status changes to SUCCESS, the message completed successfully.

5. If Stat changes to ERROR, check the error code for the reason for the message failure.

6. Reset ENABLE to clear all outputs back to 0.

WriteNet can also be used to continuously write to a parameter in a remote node by keeping the ENABLE and WRITE bits set to 1. WriteNet will start a new message as soon as the current message has been completed.

ReadNet and WriteNet will not interfere with any non-cyclic messages that they did not issue. If an RDNET command is called from elsewhere in the DPL program, ReadNet and WriteNet cannot be used to complete it.

Note:

If ReadNet and WriteNet are used in a DPL program, it is recommended that all non-cyclic commands be implelented via these blocks. An attempt to use an RDNET or WRNET command elsewhere in the DPL program may interfere with any messages in progress by ReadNet and WriteNet.

ReadNet and WriteNet must be called on every program pass. This ensures that if ENABLE is reset while a message is in progress, ReadNet or WriteNet will cancel the message with the system file. If this is not done, the message will remain in progress indefinitely. ReadNet or WriteNet will NOT cancel this message when they are re-enabled, as it will appear that another block has initiated a non-cyclic message from somewhere else in the program, and they will not interfere with it.

Example

Target/ Language Restrictions

This function is only available on options with CTNet capability - SM-Applications , UD75, MD29AN.

See Also

  • READNET

  • READNETB

  • WRITENETB

  • RDNET

  • RDNETB

  • WRNET

  • WRNETB

_______________________________________________________________________________