web
You’re offline. This is a read only version of the page.
close
Support Portal

DX35 Extracting the distance value of from 2 bytes of process data

Related Products
Dx35

Table of Contents

The process data of the Dx35 has a width of 2 bytes. With the default settings, the distance value is mapped to the entire width of two bytes.

To get the distance value, both bytes must be calculated together. To do this, byte [0] must be shifted to the left by 8 bits and then byte [1] added. This is possible with the following formula:

  • Distance =   256 * ProcessData.Byte[0] + ProcessData.Byte[1]

or with bit-shift to left:

  • Distance =  (ProcessData.Byte[0] << 8) + ProcessData.Byte[1]

 

Example (recorded with the SOPAS ET Data Recorder and open in Excel):

  • Distance = 256 * C3 + D3
  • Distance = 256 * 7 + 208 = 2000 mm

or bit-shift to left (Excel formular):

  • Distance = BITLSHIFT(C3,8) + D3
  • Distance = (7 << 8) + 208 = 2000 mm

 

Note, if the process data does not correspond to default (e. g. Distance + Q1 + Q2):

To obtain the distance value when the process data is set to e.g. Distance + Q1 + Q2, it is necessary to perform a bit-shift to the right (2-bits) after the calculation.

Example (recorded with the SOPAS ET Data Recorder and open in Excel):

Using the formula described above results in an incorrect value:

  • Distance = 256 * C17 + D17
  • Distance = 256 * 31 + 65 = 8001 mm

Therefore: bit-shift to the right (2-bits) after the calculation:

  • Distance = BITRSHIFT((256 * C18 + D18); 2)
  • Distance = (8001 >> 2) = 2000 mm

Keywords:
distance value, 2 bytes, sopas, data recorder, dx35, dx35 process data