2.2. Dataflow and Synchronization

This section outlines the facilities for controlling the refresh of field data. Input data from the field devices is read into the image buffers via the hardware interface device, which may itself contain an image buffer. Output data flows via the reverse path. Typically, the output data containing the results of a calculation cycle is refreshed first, followed by the refresh of input data to be processed. This process is summarized in the figure below:

Figure 2-2. Driver Block Data Flow

The driver performs the exchange of data to the hardware device, ensuring synchronization with any protocol-dependent update cycles inherent in the flow of data to/from the field devices.

Several mechanisms are available to trigger the data transfer:

The three phases of data exchange are as follows, and each is explained in detail further below.

  1. Transfer of data between the fieldbus and the CIF card hardware buffers (called the process image buffers).

  2. Transfer of data between the CIF card hardware buffers and the driver's buffers.

  3. Transfer of data between the driver buffers and the points (if used).

2.2.1. Data Transfer between Fieldbus and Card

Once a CIF card is configured according to the particular set of field devices, it can start up and initiate a continuous communication cycle over the fieldbus that maintains an image of the field data in the card buffers, essentially independently of the host computer (and driver software). The driver periodically interfaces to the card to exchange data between the driver's buffers and the card's buffers. This exchange can have the following characteristics:

Not all modes of data exchange are available for all fieldbus protocols. The buffered, host-controlled data exchange mode is recommended for most applications.

2.2.2. Data Transfer between Card and Driver

As stated above, the Cascade CIF Driver periodically exchanges data between its buffers (used by the application program) and the card's buffers. This can occur in either of two modes:

To configure a driver to use the interrupt mode, the card must be configured to generate interrupts, and the correct parameter must be used in the cardInit command. ISA cards require correct jumper settings, while PCI cards will autodetect the correct interrupt.

To configure a driver to use polling mode, the cardInit command must be setup correctly (even if the card is set up to generate interrupts), and it is necessary to generate the periodic polling trigger. This can be done two ways:

2.2.3. Data Transfer between Card and Points

Use of either the cardPoll or updateBuffers commands is sufficient for the user application to interface to the fieldbus using the block data model. If the point data model is used, then an additional step is required to transfer the data between the points and the buffers.

The group command is used to collect together groups of individual analog and digital points that must be updated together because they are all located in the same buffer. The group command provides for automatic periodic update by specifying a non-zero cycle time. At each cycle, all the points in the group will write or read updated data to or from the driver buffer(s). Note that the data transfer goes no further than the buffer, and one of the mechanisms described above is required to transfer data to the card. Note also that the CIF driver does not allow a cycle time to be defined for digital or analog points (must be 0).

As the period of the group refresh approaches that of the card data exchange, the interaction of the two unsynchronized cycles may create some undesirable effects. The cardGroup command is used to associate a group directly with the refresh of the buffers. The group cycle time must be set to 0 and the group point listed as a parameter to the cardGroup command. Both polled- and interrupt-drcfiven exchanges between the card and driver buffers will trigger the refresh of all the groups of points associated with the card.

The use of an independently updating group is most appropriate for points that have a relatively low refresh rate. For example, closed loop process control of a system may require a constant analog sample period in the range of 100 ms, in contrast to a fast response to digital events (as fast as the fieldbus will support, perhaps as little as 1 or 2 ms).

Use of the updateBuffers command will not trigger update of groups associated with a card. A variation of this command, updateBufferGroups, is also used to update the groups. Note that data from writable group points updates the buffers first, then the equivalent to the updateBuffers command is executed, and finally the data for readable group points is updated.

Copyright 1995-2002 by Cogent Real-Time Systems, Inc.