FP_BITCOLUMN_TO_WORD

Bit column -> bit line conversion

This FP instruction converts a bit column out of an address range starting at input s_Start and returns each bit in a bit line at output d. The bit position is specified at input n_Pos (range 0–15). This instruction is the reversion of FP_WORD_TO_BITCOLUMN.

Parameters

Input

s_Start (WORD)

Starting address of the bit column

n_Pos (WORD, INT, UINT)

Bit position (range 0–15)

Output

d (WORD)

Result

Error flags

sys_bIsOperationErrorHold (turns to TRUE and remains TRUE)
  • if the area specified using the index modifier exceeds the limit.

  • if 0 ³ n_Pos > 15

  • if s_Start is out of range

sys_bIsOperationErrorNonHold (turns to TRUE for one scan)
  • if the area specified using the index modifier exceeds the limit.

  • if 0 ³ n_Pos > 15

  • if s_Start is out of range

Example

POU header

All input and output variables used for programming this function have been declared in the POU header. The same POU header is used for all programming languages.

	VAR
		bStart: BOOL:=FALSE;
			(*activates the function*)
		iPosition: INT:=10;
			(*specifies the position
of the column*)
		wBit_combination: WORD:=16#0;
			(*result after a 0->1 leading
edge from start:
2#1100011110111000*)
	END_VAR

POU body

When the variable bStart is set to TRUE, the function is carried out. The bit column at bit position 10 of the data starting at DT10 is output as 0101 0001 1101 1001 at d.

LD body

BODY
    WORKSPACE
        NETWORK_LIST_TYPE := NWTYPELD ;
        ACTIVE_NETWORK := 0 ;
    END_WORKSPACE
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 6 ;
        NETWORK_BODY
B(B_F,FP_BITCOLUMN_TO_WORD!,,13,1,26,6,,?DEN?Ds_Start?Dn_Pos?AENO?Cd);
B(B_CONTACT,,bStart,6,2,8,4,);
B(B_VARIN,,DT10,11,3,13,5,);
B(B_VARIN,,iPosition,11,4,13,6,);
B(B_VAROUT,,wBit_combination,26,3,28,5,);
L(1,3,6,3);
L(8,3,13,3);
L(1,0,1,6);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

IF bStart then
    FP_BITCOLUMN_TO_WORD(s_Start := DT10, n_Pos := iPosition, d => wBit_combination);
END_IF;

Modified on: 2019-04-17Feedback on this pagePanasonic hotline