nmpRGBToDint (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

MX2i pro, CX1 pro/flex/warp, SX1, MX2 turbo, NX-200, NX-400, NX-900, LX2

Firmware version:

2.84 / 1.00.00

Nav. API level:

2


This function will convert the provided 3-color components to a single DINT that contains the resulting color.

The format of the resulting color as a hex value is 16#00_rr_gg_bb, where "rr", "gg", and "bb" are the hex representation of the three components.

 

Input:

r : INT (0..255)

The red component of the color.

 

g : INT (0..255)

The green component of the color.

 

b : INT (0..255)

The blue component of the color.

 

 

Returns: DINT

The color.

 

Declaration:

FUNCTION nmpRGBToDint : DINT;
VAR_INPUT
   r   : INT;
   g   : INT;
   b   : INT;
END_VAR;

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
VAR
color : DINT;
END_VAR;
BEGIN
  ...
  // Set color
   color := nmpRGBToDint(r := 8, g:= 146, b := 206);
  ...
END;
END_PROGRAM;