[etherlab-users] 64-bit integers in Etherlab OK?

Julian Stoev julian.stoev at gmail.com
Thu Jun 11 14:00:09 CEST 2009


Hello again,

I would like to provide more info and thoughts on the problem I have,
which may concern a general problem in the Etherlab code.

It appears to me that the current version of Etherlab supports up to
32 bit integer data.
This can be found in the comments of ec_slave2.c

 * 10. Pdo Entry Info - N-by-4 numeric matrix
 *   A matrix of 3 columns describing the PDO entry information. It is used
 *   to configure the slave's PDO's. The columns have the following
 *   functions:
 *    1 - Index
 *    2 - Subindex
 *    3 - Bit length: number of bits that are mapped by the pdo entry
 *    4 - PDO Data type: one of 1, -8, 8, -16, 16, -32, 32 mapping to
 *        SS_BOOLEAN, SS_INT8, SS_UINT8, SS_INT16, SS_UINT16,
 *        SS_INT32 and SS_UINT32

Same can be found also in the ec_slave2.c code in the function
get_data_type, for example:

    else if (width > 32) {
        reason = "Unsigned data type must be in the range [1..32].";
        goto out;
     }
This is actually the part which signals error in my case, as reported before.

But current EL5101 XML files definitely have 64 bit integer objects.
And according to my understanding my hardware requires this new XML
files.

I found this in the Matlab RTW documentation (C API for S-Functions):
void ssGetElapseTimeCounter(SimStruct *S, (void *)elapseTime): This
function is provided for the use of blocks that require the elapsed
time values for fixed-point computations. ssGetElapseTimeCounter
returns, to the location pointed to by elapseTime, the integer value
of the elapsed time counter associated with the S-function. If the
counter size is 64 bits, the value is returned as an array of two
32-bit words, with the low-order word stored at the lower address.

To determine how to access the returned counter value, obtain the data
type of the counter by calling ssGetElapseTimeCounterDtype, as in the
following code:

int    *y_dtype;
ssGetElapseTimeCounterDtype(S, y_dtype);

 switch(*y_dtype) {
  case SS_DOUBLE_UINT32:
      {
          uint32_T dataPtr[2];
          ssGetElapseTimeCounter(S, dataPtr);
      }
      break;
  case SS_UINT32:
      {
         uint32_T dataPtr[1];
         ssGetElapseTimeCounter(S, dataPtr);
     }
      break;
  case SS_UINT16:
     {
          uint16_T dataPtr[1];
          ssGetElapseTimeCounter(S, dataPtr);
     }
      break;
  case SS_UINT8:
     {
         uint8_T dataPtr[1];
         ssGetElapseTimeCounter(S, dataPtr);
    }
     break;
  case SS_DOUBLE:
      {
         real_T dataPtr[1];
         ssGetElapseTimeCounter(S, dataPtr);
     }
      break;
  default:
    ssSetErrorStatus(S, "Invalid data type for elaspe time
        counter");
    break;
}

So here we see a 64 bit object SS_DOUBLE_UINT32 is available and maybe
this can be used to change the current Etherlab code and permit access
to 64 bit data.

Before I plunge unto changes of this magnitude, taking into account my
limited experience in this area, it would be nice if somebody can at
least confirm if this would be the right approach.

Thanks a lot!


-- 
Julian Stoev, PhD.
Control Researcher



More information about the Etherlab-users mailing list