Support Portal

How to interpret the process data of the CSS color sensor

Extract the needed information of the css process data bytes.
Related Products
CSS High Resolution
CSS/CSX High Speed

Table of Contents

General

The process data of the CSS color sensor consists of 12 bytes of data. In general, two types of process data structures can be set. They can be set using the ISDU: Process data select - Index 120, Subindex 0.

  • If the value of this index and subindex is zero (false), the evaluation mode is selected.
  • If the value of this index and subindex in one (true), the measurement mode is selected.

Content of Evaluation Mode

The process data bytes include the CMV (Color Matching Value) value of QL1-4, the output bits of QL1-4 and Qint 1-24 as well as a bit for QoR (quality of run) alarm and a bit to signalize if the data is valid or not. 

 

Detailed information can be found in the IODD-Information of the CSS:

Content of Measurement Mode

The process data bytes include the RGB or LAB values, the CMV value of QL1, the output bits of QL1-4 and Qint 1-24, a bit for QoR (quality of run) alarm and a bit to signalize if the data is valid or not. 


Detailed information can be found in the IODD-Information of the CSS:

How to interpret the CMV value bytes

A CMV value consists of 2 bytes: 

0000 0000   0000 0000

 

Due to the fact the maximum decimal value for the CMV is 999, only 9 of 16 bits are used.

 

Examples

 

CMV - Decimal CMV - Binary (16 bits, 2 bytes)
980 0000 0011   1101 0100
453 0000 0001   1100 0101
745 0000 0010   1110 1001
999 0000 0011   1110 0111

 

How to interpret the RGB or LAB value bytes

Note that the color space -RGB or LAB- can be selected via the ISDU Index 296. Default is RGB in false state. If true, the sensor will change the process data output to LAB space.

RGB-Values

The R, G and B channel are mostly known for a value range from 0-255. This may be the case for matt, colored surfaces or objects. But if the object or surface is glossy, the sensors receiver gets back much more of the sent signal. To work with signal as well, the signal can rise above the value 255. In this case the second byte will be used, because decimal numbers > 255 need more than 8 bits. 

 

The calculation out of the binary data works just as mentioned for the CMV values. 

LAB-Values

In the LAB color-space the L axis is always a positive number. The calculation here is as simple as mentioned above.

The other axis A and B can be a positive or negative value. For this the two's complement format is used. You can find a bunch of information on the internet, how this is done. 
In general, the leading bit signalizes if the number is negative (leading bit = true) or positive (leading bit = false). The format is according to the mentioned two's complement.

 

After calculating the decimal value, they have to be divided by 100!

 

Example
The "A" channel is hex 0xFE39 (bin 1111 1110   0011 1001). This results in decimal -455. Divided by 100, the result is -4.55 for the channel "A".

 

The "L" value has the same behavior as mentioned for the RGB values and can rise higher than expected, if the surface is glossy.

How to interpret all other bytes or bits

All other bytes exist of single bits which give information about the output state, alarm(s) or invalid process data. If one of those bits is true, the corresponding output is also true. Same behavior for the alarm bit and the process data bit.

Keywords:
css, css color sensor, interpretation, process data, io-link, color, color sensor