FP_WORD_TO_BITCOLUMN

Bit line -> bit column conversion

This FP instruction creates a bit column out of a value given at input s that is returned within the address specified by d_Start. The bit position of the column at d_Start is specified at input n_Pos (range 0–15). This instruction is the reversion of FP_BITCOLUMN_TO_WORD.

Parameters

Input

s (WORD)

Input value

n_Pos (WORD, INT, UINT)

Bit position (range 0–15)

Output

d_Start (WORD)

Starting address of the data area for the results. The size is n_Bits * 2 words.; only the specified bit column will be rewritten

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*)
		wBit_combination: WORD:=16#51D9;
		iPosition: INT:=10;
			(*specifies the position
of the column*)
	END_VAR

POU body

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

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_WORD_TO_BITCOLUMN!,,16,0,29,5,,?DEN?D@'s'?Dn_Pos?AENO?Cd_Start);
B(B_CONTACT,,bStart,7,1,9,3,);
B(B_VARIN,,wBit_combination,14,2,16,4,);
B(B_VARIN,,iPosition,14,3,16,5,);
B(B_VAROUT,,DT10,29,2,31,4,);
L(9,2,16,2);
L(1,2,7,2);
L(1,0,1,6);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

IF (bStart) then
    FP_WORD_TO_BITCOLUMN(s := wBit_combination, n_Pos := 10, d_Start => DT10);
END_IF;

Modified on: 2019-01-23Feedback on this pagePanasonic hotline