Control mechanism

In general the task of each defined function block of the CAA_Cia405.Library is to read or to write one or more parameters. Such parameters can be variables or states at CANopen connected devices (SDO, EMCY, NMT-state) or at the local node (own node number, CANopen kernel state). Therefore each function block performs the same behavior in general.

A typical behavior of the control signals ENABLE, CONFIRM and ERROR is shown at the SDO access:

插图 562: Request/Response diagram
  •  The peak at the symbol shows the time when the event occurs. The symbol shows that the message is ignored. High level at ENABLE and CONFIRM signals TRUE; low level signals FALSE. High level at ERROR signals a value > 0; low level signals value = 0.
  • PLC cycles: the diagram shows, that there is no relation between the signal timing and the PLC cycles, i.e. the response can be available immediately or some PLC cycles later.
  • Timeout: the time control starts with a rising edge at ENABLE. Timeout event occurs, when there is no response available before time control reaches the timeout value. When timeout occurs, ERROR = 3 and ERRORINFO may contain additional error information using the SDO-Abort data format. If there is no additional error information available, ERRORINFO is 0.

Request:

The "no error" as well as the "error" condition shows, that immediately with the rising edge detected at Input ENABLE the Request event occurs, i.e. it is put to a lower level software. The outputsstay at their initial values. The program control is given back to the caller if the Response or Abort is not available immediately.

A:Response: As soon as the SDO-Response message is available the output CONFIRM is set TRUE and stays TRUE as long as the function block is called with input ENABLE=TRUE. When the function block is called with ENABLE=FALSE, CONFIRM is ste FALSE, i.e. the initial value.

 

B:Abort: As soon as the SDO-Abort message is available the output ERROR is set to value 1 and more error information is available in the output ERRORINFO ("further error register" /DS405/). The outputs stay stable as long as the function block is called with input ENABLE = TRUE. When the function block is called with ENABLE = FALSE, ERROR and ERRORINFO are set to 0, these are their initial values.

 

C: ENABLE = FALSE before Response or Abort available: As soon as the function block is called with ENABLE = FALSE, the outputs are set to their initial values, i.e. CONFIRM = FALSE, ERROR = 0, ERRORINFO = 0. A possibly available Response or Abort is ignored as well as a later arriving Response or Abort.

 

D: Timeout: When the function block is called and timeout is detected and Response or Abort is not available, ERROR = 3 and ERRORINFO may contain additional error information using the SDO-Abort data format. If there is no additional error information available, ERRORINFO is 0.

Flow control

The function block stays in idle, i.e. all outputs are set to their initial values and it executes no operation, as long as input ENABLE is FALSE. The number of calls does not matter.

As soon as ENABLE performs a rising edge, the function block will start execution, i.e. it will read the input values and put a request to a lower level software, e.g. to read or write a selected parameter. If the response to the request is available immediately, like the return value on a function call, the function block will set the outputs immediately and finish its task. For example, a function which gets the local node id, may work in that way. If the response is not available immediately, the function block gives the program control back to the caller with all output signals at busy state, e.g. CONFIRM = FALSE and ERROR = 0.

On each call of the function block, the availability of the response is checked and the timeout, if applicable. Changing input values except ENABLE are ignored.

If the response signals an error condition or the timeout is reached, the function block set the outputs to error state, e.g. CONFIRM = FALSE and ERROR <> 0 and finishes its task.

If the response signals success, the function block sets the outputs to confirm state, e.g. CONFIRM = TRUE and ERROR = 0 and, if it was a read request, the data outputs to the actual requested values and finishes its task.

提示!

In /DS405/ it is not clearly defined if the function block starts execution again a) immediately, b) on the next call or c) after the next rising edge at input ENABLE. To give other function blocks the chance to access the same device on the same SDO-channel, it is recommended to wait at least one PLC cycle (b) before starting execution again. This avoids, that one function block, called with input ENABLE = TRUE forever, could block the communication to one device. A disadvantage may be in case a) and b), that the function block does not signalize when a new response, e.g. new data, is available. The user does not know how old the delivered data are. On write requests, the user does not know if the input data are transmitted to the device before they are changed. Further it is doubtful to transmit the same data several times. For this reasons it is recommended to do not start execution again when ENABLE stays TRUE (c). When ENABLE becomes FALSE all outputs are set to their initial values immediately. A possibly available response is ignored as well as an ongoing processed request. A rising edge at ENABLE starts the flow control from the beginning.

提示!

In /DS301/ (V 4.02 chap. 9.2.2.1.7) is defined regarding the SDO-Abort: "The service may be executed at any time by both the client and the server of a SDO. If the client of a SDO has confirmed service outstanding, the indication of the abort is taken to be the confirmation of that service."