7.3. SST 5136-DNP Card

For more information on the DVN Driver, please refer to the Cogent SST-DVN Driver for SST DeviceNet Cards manual.

7.3.1. I/O Block Functions

The DR_ApReadBlock and DR_ApWriteBlock functions access the process I/O data area of the card. The offset and size parameters specify what portion of the buffer area to transfer, and is dependent on the field configuration. Typically, field data is always mapped to the beginning of the block (offset of 0) and is continguous up to the number of bytes defined by the field device (slave) configuration. The output process data buffer is mapped as buffer 0, while 1 will access the input process data buffer.

7.3.2. Control Block Functions

No control functions are currently accessible by the user.

7.3.3. Status Block Functions

The DR_ApReadStatus function accesses the status blocks of the card. Only buffer 1 is valid for 5136-DNP cards, which provides status information about the CANbus as well as client-server and field device status.

The status of the SST 5136-DNP Card is read from buffer 1 with a length of 80 bytes, using the function DR_ApReadStatus, as follows in this example:

DR_ApReadStatus (card, 1, 0, 80, &status, &error)

The offset parameter (0) is ignored. The size parameter can be less than the maximum size (80) if only a portion of the status structure is required. Status is a structure of type dr5136dn_ApState_t (see the file dvn_api.h) and is defined as follows:

typedef struct
{
    unsigned short CanStatus;       /* see Ap_DNS_eCAN_STATUS_CODE below */
    unsigned short CanTx;           /* CAN transmit counter              */
    unsigned short CanAck;          /* CAN ACK error counter             */
    unsigned short CanRx;           /* CAN receive counter               */
    unsigned short CanErr;          /* CAN error counter                 */
    unsigned short CanLost;         /* CAN messages lost counter         */
    unsigned short CanOverrun;      /* Receive queue overrun counter     */

    unsigned char  ClientStatus;    /* 0 Idle 1 Active                   */
    unsigned char  ServerStatus;    /* 0 Idle 1 Active                   */
    unsigned char  DeviceStatus[64];/* see Ap_DNS_eDEV_STATUS_CODE below */
}
dr5136dn_ApState_t; /* SST 5136-DN DeviceNet */

where:

State ElementDescriptionLength
CanStatusCAN status, one or more of the following flags:word (2 bytes)
 CanStatus flagValueDescription
CAN_ONLINE0x0001CAN interface ready to communicate
CAN_BUSWARN0x0002CAN bus warning
CAN_BUSOFF0x0004CAN offline due to excessive errors
CAN_ACTIVITY0x0008CAN activity detected
CAN_TACKERR0x0010CAN transmission not acknowledged
CAN_TIMEOUT0x0020CAN transmission incomplete
CAN_OVERRUN0x0040CAN receive buffer overrun
CAN_LOST0x0080CAN message lost
CAN_ERROR0x0100CAN bus error
CAN_BUSPOWER0x0200CAN bus power present
CAN_ONLINE1250x1000CAN Online at 125 Kbaud
CAN_ONLINE2500x2000CAN Online at 250 Kbaud
CAN_ONLINE5000x4000CAN Online at 500 Kbaud
CAN_SCANACTIVE0x8000CAN Scanner active
State ElementDescriptionLength
CanTxCAN transmit counterword (2 bytes)
CanAckCAN ACK error counterword (2 bytes)
CanRxCAN receive counterword (2 bytes)
CanErrCAN error counterword (2 bytes)
CanLostCAN messages lost counterword (2 bytes)
CanOverrunReceive queue overrun counterword (2 bytes)
ClientStatus
0 Idle
1 Active
1 byte
ServerStatus
0 Idle
1 Active
1 byte
DeviceStatus[64]Table of field device statuses, one byte per device, each containing one of the following values:64 x byte
 DeviceStatus[64] flagValueDescription
DS_DEV_NOT_IN_LIST0x00Device not in device list
DS_DEV_IDLE0x01Device idle (not scanned)
DS_DEV_SCANNED0x02Device being scanned
DS_DEV_TIMEOUT0x03Device timed-out
DS_UCMM_CONN_ERROR0x04UCMM connection error
DS_CONNECTION_BUSY0x05Mstr/slv connection set busy
DS_CONN_ALLOC_ERR0x06Error allocating mstr/slv connection set
DS_VEND_ID_INVALID0x07Invalid vendor id
DS_VEND_ID_RD_ERR0x08Error reading vendor id
DS_DEV_TYPE_INVALID0x09Invalid device type
DS_DEV_TYPE_RD_ERR0x0AError reading device type
DS_PRODCODE_INVALID0x0BInvalid product code
DS_PRODCODE_RD_ERR0x0CError reading product code
DS_CONN1ISIZE_INV0x0DInvalid I/O connection 1 input size
DS_CONN1ISIZE_RD_ERR0x0EError reading I/O connection 1 input size
DS_CONN1OSIZE_INV0x0FInvalid I/O connection 1 output size
DS_CONN1OSIZE_RD_ERR0x10Error reading I/O connection 1 output size
DS_CONN2ISIZE_INV0x11Invalid I/O connection 2 input size
DS_CONN2ISIZE_RD_ERR0x12Error reading I/O connection 2 input size
DS_CONN2OSIZE_INV0x13Invalid I/O connection 2 output size
DS_CONN2OSIZE_RD_ERR0x14Error reading I/O connection 2 output size
DS_CONN1_PCKRATE_ERR0x15Error setting I/O connection 1 packet rate
DS_CONN2_PCKRATE_ERR0x16Error setting I/O connection 2 packet rate
DS_CONN_SYNC_FAULT0x17Mstr/slv connection set sync fault
DS_PIT_ERR0x18Error setting Production inhibit time