I2C_PCF8574_read block

Short summary

Name

I2C_PCF8574_read

→POU type

→function

Category

more system blocks, blocks for I2C elements

Graphical interface

images/download/thumbnails/414780064/I2C_PCF8574_read-version-1-modificationdate-1534490803570-api-v2.png

Available since

  • version 1.13.0 (for logi.CAD 3) and version 2.3.901 of logi.RTS
    images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/warning.svg This block is supported for →Raspberry Pi only.

  • version 1.109.0 (for logi.CAD 3) and version 3.19.0 of logi.RTS
    images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/warning.svg This block is supported for Raspberry Pi and the platform LinuxX86 only.

Functionality

The block reads the states of inputs from PCF8574 (→I2C port expanders).

For more information on the PCF8574 chip see for example: http://www.nxp.com/documents/data_sheet/PCF8574.pdf (product specification by manufacturer NXP)

Inputs, return value


Identifier

→Data type

Description

Inputs:

fd

DINT

the handle for the I2C device file opened by the I2C_Open block

address

INT

the I2C address of the PCF8574 (port expander)

Return value:

ARRAY[0..7] OF BOOL

returns the states of the pins of the PCF8574 (port expander)

Input EN and output ENO are available when →calling the block. See "Execution control: EN, ENO" for information on input EN and output ENO.

Example for usage within ST-editor

PROGRAM Test
VAR
handle : DINT := -1;
digitals : ARRAY[0..7] OF BOOL;
END_VAR;
ENO := TRUE;
IF handle < 0 THEN
handle := I2C_open(bus_id := 1, ENO => ENO);
ELSIF ENO THEN
digitals := I2C_PCF8574_read(fd := handle, address := 56, ENO => ENO);
END_IF;
END_PROGRAM

When creating your application within the ST-editor, enter a call of a block by typing the text as requested by the syntax or use Content Assist.