7.2. Hilscher Fieldbus CIF Card Control API

The control parameters for the Hilscher Fieldbus card use the following structure (see file cif_api.h):

    typedef struct {
         unsigned char	Mode;
         unsigned char	reserved1;
         unsigned char	Format;
         unsigned short	WatchdogTime;
         unsigned char	reserved5[3];
         unsigned char	reserved8[8];
    } cif_ApParms_t;

The control parameters do vary with the specific fieldbus protocol and additional structure definitions can be found in the cif_api.h file.

Access to the control data is accomplished via buffer 2 with a length of 16, using the functions DR_ApReadControl and DR_ApWriteControl, as follows:

    DR_ApReadControl (dev, 2, 0, 16, &control, &error)
    DR_ApWriteControl (dev, 2, 0, 16, &control, &error)

It is recommended that reserved bytes be set to 0. Most protocols reserve the last 11 bytes, so the length may be shortened to 5, depending on the protocol. Note that a read of the control parameters may return only zero data from some cards.

The components of the control structure are defined as follows:

ParameterDescriptionLength
ModeType of handshake mechanism for process data delivery.byte
Cycle_timeCycle time of the fieldbus cycle (hwere applicable).byte
FormatStorage format of word data.byte
WatchdogTimeHOST-supervision time in multiples of a msec.short

The handshake modes available are:

ModeName (see cif_api.h)Description
0IOMODE_DEV_UNBUFcard controlled, bus synchronous data transfer
1IOMODE_DEV_BUFcard controlled, buffered data transfer
2IOMODE_NO_CTLno handshake
3IOMODE_HOST_BUFHOST controlled, buffered data transfer
4IOMODE_HOST_UNBUFHOST controlled, bus synchronous data transfer

Not all modes are available for all protocols.

The available storage formats are:

FormatName (see cif_api.h)Description
0FORMAT_INTELIntel; little-endian; low-byte, high-byte
1FORMAT_MOTORLAMotorola; big-endian; high-byte, low-byte

After writing the control block, the system must do a WARM reset before the changes will take effect (see the cardReset command in the Device Driver for Hilscher CIF Cards manual).

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