Hello All,
I am using CVI 7.0 for DeviceNet communication with or device...
I have a problem with ReadIO with COS or Cyclic...
It works perfectly when I open a polled IO connection, the data buffer retrieved correspond to my selected assembly...
If I open a COS or Cyclic IO, the Data buffer is giving me random number... If I explicitly read the proper Epath through the Assembly Object, the buffer looks fine...
This is the code that I use to get the proper data
NCTYPE_UINT8 locServiceCode = 0;
NCTYPE_UINT8 locServiceData[ 80 ];
NCTYPE_UINT8 * locpServiceDataPointer = locServiceData;
NCTYPE_UINT16 locActualServiceDataLength = 0;
NCTYPE_UINT16 locProduceInstance = 0;
// Read he
if (glConnType == eCOS)
{
GetAttributeSingle(GetGlobalDeviceHandle(), eCONNNECTION_ID, 1, 102, &locProduceInstance);
}
else
{
GetAttributeSingle(GetGlobalDeviceHandle(), eCONNNECTION_ID, 1, 104, &locProduceInstance);
}
locActualServiceDataLength = 1;
locServiceData[0] = 0x03;
locErrorCode = DoService(GetGlobalDeviceHandle(), 0x0E, eASSY_ID, locProduceInstance, &locActualServiceDataLength, locServiceData, sizeof( locServiceData ), locServiceData );
memcpy(*locpReadIoDataBuff, locServiceData, locActualServiceDataLength);
}