Function block

FB_Pixel_LED

Function block 1:Fig.157: FB_Pixel_LED

Inputs

Name

Type

Description

tTimeout

TIME

Timout for the transmission process to the terminal

bShow

BOOL

Rising edge starts the transmission and display of data

Outputs

Name

Type

Description

bBusy

BOOL

Is TRUE if the FB transmits data to the terminal. Data cannot be changed during this time

Definition of constants

The following constants must be defined in the function block before the program is started:

Function block 2:Fig.158: Definition of constants

Name

Type

Description

nWidth

INT

Width of the entire matrix

nHeigth

INT

Height of the entire matrix

XTiles

INT

Number of individual matrices in X direction (width)

YTiles

INT

Number of individual matrices in Y-direction (height)

bMatrixSerpentineLayout

INT(0..1)

Layout type (see M_CursorToIndex)

bMatrixVertical

INT(0..1)

Layout of the LED lines is vertical (see M_CursorToIndex)

nNumberofChannels

INT

Number of EL2574 channels used

Methods

• M_ClearAll

This method can be used to set all elements of the array to the value 0.

• M_Clear

This method can be used to set all elements of the array in a given rectangle to the value 0.

Function block 3:Fig.159: M_Clear

Inputs

Name

Type

Description

nX1

INT

Start position of the pixels to be deleted in X direction

nY1

INT

Start position of the pixels to be deleted in Y direction

nX2

INT

End position of the pixels to be deleted in X direction

nY2

INT

End position of the pixels to be deleted in Y direction

• M_DrawImage

This method can be used to display an image statically on a matrix.

Function block 4:Fig.160: M_DrawImage

Inputs

Name

Type

Description

nXPosition

INT

Start position for displaying the image in X direction

nYPosition

INT

Start position for displaying the image in Y direction

pImageArray

POINTER TO ARRAY [0..0] OF DWORD

Pointer to the array containing the image data

pImageWidth

POINTER TO INT

Pointer to the width of the image

pImageHeight

POINTER TO INT

Pointer to the height of the image

The supplied HTML page ImageConverter.html (see chapter "ImageConverter.html") can be used to display images. The image uploaded there should not exceed the resolution of the pixel matrix; smaller images can be used without restriction. After uploading an image file, the web page will download a text file. This file contains PLC variable definitions that must be included in the PLC project. This can be done, for example, by copying the content into a GVL. The "M_DrawImage" method can be used to display the image on the matrix by assigning the addresses of the copied variables to the input pointers of the method.

• M_DrawText

This method can be used to display a string statically on a matrix.

Function block 5:Fig.161: M_DrawText

Inputs

Name

Type

Description

nXPosition

INT

Start position for displaying the text in X direction

nYPosition

INT

Start position for displaying the text in Y direction

nColor

DWORD

Text color (0xWWBBGGRR)

sText

STRING

Display text

A basic font is stored in the declaration section of the constants in the function block. To use a different font and / or font size, the supplied HTML page FontConverter.html (see chapter "FontConverter.html") can be used.

Function block 6:Fig.162: PLC variable definitions

• M_ScrollText

This method can be used to display a string from right to left on a matrix.

Function block 7:Fig.163: M_ScrollText

Inputs

Name

Type

Description

nXPosition

INT

Start position for displaying the text in X direction

nYPosition

INT

Start position for displaying the text in Y direction

nXEndPosition

INT

End position to display the text in X direction

Note: If nXEndPosition = -1, the text is output from the start position across the entire width of the matrix

nScrollPosition

POINTER TO INT

Pointer to auxiliary variable to track the scroll position (an auxiliary variable is required for each text)

nColor

DWORD

Text color (0xWWBBGGRR)

sText

STRING

Display text

A basic font is stored in the declaration section of the constants in the function block. To use a different font and / or font size, the supplied HTML page FontConverter.html (see section 6.3.2) can be used.

• M_RotateAll

This method rotates the entire content of the matrix in a given direction.

Function block 8:Fig.164: M_RotateAll

Inputs

Name

Type

Description

nDirection

INT(0…3)

Direction preset

0: Left, 1: Right, 2: Up, 3: Down

• M_Rotate

This method rotates the contents of the matrix in a given rectangle in a given direction.

Function block 9:Fig.165: M_Rotate

Inputs

Name

Type

Description

nDirection

INT(0…3)

Direction preset

0: Left, 1: Right, 2: Up, 3: Down

nX1

INT

Start position of the pixels to be rotated in X direction

nY1

INT

Start position of the pixels to be rotated in Y direction

nX2

INT

End position of the pixels to be rotated in X direction

Note: If nX2 = -1, the entire matrix width is rotated from nX1

nY2

INT

End position of the pixels to be rotated in Y direction

Note: If nY2 = -1, the entire matrix height is rotated from nY1

• M_SetPixel

This method allows individual pixels to be switched on in a specific color.

Function block 10:Fig.166: M_SetPixel

Inputs

Name

Type

Description

nXPosition

INT

Pixel position in X direction

nYPosition

INT

Pixel position in Y direction

nColor

DWORD

Color of the pixel (0xWWBBGGRR)

• M_GetPixel

This method reads the color of a pixel at a specified position from the buffer.

Function block 11:Fig.167: M_GetPixel

Inputs

Name

Type

Description

nXPosition

INT

Pixel position in X direction

nYPosition

INT

Pixel position in Y direction

nColor

DWORD

Color of the pixel (0xWWBBGGRR)

Outputs

Name

Type

Description

M_GetPixel

DWORD

Color of the pixel (0xWWBBGGRR)