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

Writenetb

WriteNet allows a DPL progam to write to 10 different parameters in another CTNet node using non-cyclic data from any task in the DPL program. The WRNETB 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 SM-Applications to continue with other tasks while waiting for a reply.

Note:

WriteNetB cannot be used in a UD70 or MD29AN DPL program to issue block write messages, but they will respond correctly to WriteNetB. CTNet I/O Couplers must be fitted with firwmare V1.03.00 or later to respond to WriteNetB.

Arguments

Node% - 0 to 255

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

Par% - 0 to 9999

Array in which each index specifies the parameter to be written to, in the format MMPP, e.g. 1820 means #18.20.

Val% - Signed 32-bit

Array in which each index stores the value to be written to the target parameter.

Dp% - -1 to 3

Array in which each index stores number of decimal places.

Res%

Array in which each index returns a status code to indicate the success or otherwise of the write to the corresponding parameter in the Par% array.

NPars% - 1 to 10

Specifies the number of parameters to write. The Par%, Val%, Dp% and Res% arrays must be large enough to handle this number of parameters.

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.

Note:

Stat% = SUCCESS means that a response was received from the target node. IT DOES NOT NECESSARILY MEAN THAT ALL DATA VALUES WERE WRITTEN OK!!! The Res% array contains status codes for each parameter write, this array MUST be checked to ensure that every parameter was written successfully.

Error%

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

The steps for implementing a WriteNetB message are:

1. Set target node address, target parameter reference, data value to be written, number of decimal places and time-out 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.

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

WriteNetB will not interfere with any non-cyclic messages that it did not issue. If a non-cyclic command is called from elsewhere in the DPL program, WriteNetB cannot be used to complete it.

Note:

It is recommended that ReadNet, WriteNet, ReadNetB and WriteNetB are used for all non-cyclic parameter accesses.

WriteNetB must be called on every program pass. This ensures that if ENABLE is reset while a message is in progress, WriteNetB will cancel its current message. Failure to do this may leave the message in progress indefinitely. ReadNetB, ReadNet and 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.

Note:

Broadcast WriteNetB must NOT be used if the CTNet network contains Unidrive (UD75) or Mentor II (MD29AN) nodes. These devices respond (incorrectly) to a broadcast WriteNetB message, and this will cause problems for subsequent non-cyclic message commands.

Example

Target/ Language Restrictions

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

See Also

  • READNET

  • READNETB

  • WRITENET

  • RDNET

  • RDNETB

  • WRNET

  • WRNETB

________________________________________________________________________________