For more information on the DVN Driver, please refer to the Cogent SST-DVN Driver for SST DeviceNet Cards manual.
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.
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 Element | Description | Length |
|---|---|---|
| CanStatus | CAN status, one or more of the following flags: | word (2 bytes) |
| CanStatus flag | Value | Description | |
| CAN_ONLINE | 0x0001 | CAN interface ready to communicate | |
| CAN_BUSWARN | 0x0002 | CAN bus warning | |
| CAN_BUSOFF | 0x0004 | CAN offline due to excessive errors | |
| CAN_ACTIVITY | 0x0008 | CAN activity detected | |
| CAN_TACKERR | 0x0010 | CAN transmission not acknowledged | |
| CAN_TIMEOUT | 0x0020 | CAN transmission incomplete | |
| CAN_OVERRUN | 0x0040 | CAN receive buffer overrun | |
| CAN_LOST | 0x0080 | CAN message lost | |
| CAN_ERROR | 0x0100 | CAN bus error | |
| CAN_BUSPOWER | 0x0200 | CAN bus power present | |
| CAN_ONLINE125 | 0x1000 | CAN Online at 125 Kbaud | |
| CAN_ONLINE250 | 0x2000 | CAN Online at 250 Kbaud | |
| CAN_ONLINE500 | 0x4000 | CAN Online at 500 Kbaud | |
| CAN_SCANACTIVE | 0x8000 | CAN Scanner active |
| State Element | Description | Length | ||
|---|---|---|---|---|
| CanTx | CAN transmit counter | word (2 bytes) | ||
| CanAck | CAN ACK error counter | word (2 bytes) | ||
| CanRx | CAN receive counter | word (2 bytes) | ||
| CanErr | CAN error counter | word (2 bytes) | ||
| CanLost | CAN messages lost counter | word (2 bytes) | ||
| CanOverrun | Receive queue overrun counter | word (2 bytes) | ||
| ClientStatus |
| 1 byte | ||
| ServerStatus |
| 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] flag | Value | Description | |
| DS_DEV_NOT_IN_LIST | 0x00 | Device not in device list | |
| DS_DEV_IDLE | 0x01 | Device idle (not scanned) | |
| DS_DEV_SCANNED | 0x02 | Device being scanned | |
| DS_DEV_TIMEOUT | 0x03 | Device timed-out | |
| DS_UCMM_CONN_ERROR | 0x04 | UCMM connection error | |
| DS_CONNECTION_BUSY | 0x05 | Mstr/slv connection set busy | |
| DS_CONN_ALLOC_ERR | 0x06 | Error allocating mstr/slv connection set | |
| DS_VEND_ID_INVALID | 0x07 | Invalid vendor id | |
| DS_VEND_ID_RD_ERR | 0x08 | Error reading vendor id | |
| DS_DEV_TYPE_INVALID | 0x09 | Invalid device type | |
| DS_DEV_TYPE_RD_ERR | 0x0A | Error reading device type | |
| DS_PRODCODE_INVALID | 0x0B | Invalid product code | |
| DS_PRODCODE_RD_ERR | 0x0C | Error reading product code | |
| DS_CONN1ISIZE_INV | 0x0D | Invalid I/O connection 1 input size | |
| DS_CONN1ISIZE_RD_ERR | 0x0E | Error reading I/O connection 1 input size | |
| DS_CONN1OSIZE_INV | 0x0F | Invalid I/O connection 1 output size | |
| DS_CONN1OSIZE_RD_ERR | 0x10 | Error reading I/O connection 1 output size | |
| DS_CONN2ISIZE_INV | 0x11 | Invalid I/O connection 2 input size | |
| DS_CONN2ISIZE_RD_ERR | 0x12 | Error reading I/O connection 2 input size | |
| DS_CONN2OSIZE_INV | 0x13 | Invalid I/O connection 2 output size | |
| DS_CONN2OSIZE_RD_ERR | 0x14 | Error reading I/O connection 2 output size | |
| DS_CONN1_PCKRATE_ERR | 0x15 | Error setting I/O connection 1 packet rate | |
| DS_CONN2_PCKRATE_ERR | 0x16 | Error setting I/O connection 2 packet rate | |
| DS_CONN_SYNC_FAULT | 0x17 | Mstr/slv connection set sync fault | |
| DS_PIT_ERR | 0x18 | Error setting Production inhibit time |
Copyright © 1995-2006 by Cogent Real-Time Systems, Inc. All rights reserved.