FP_7SEGMENT

7-segment decode

This FP instruction converts the data or constant specified by s to 4-digit data for 7-segment indication if the trigger EN is TRUE. The converted data is stored in the area starting at d. 7-segment indication requires 8 bits (1 byte) to represent 1 digit.

Parameters

Input

s (WORD)

Data or constant

Output

d (DWORD)

Converted data or constant

Error flags

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

  • if the result is out of range

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

  • if the result 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*)
		wInput_value: WORD:=16#A731;
		wOutput_value: WORD:=0;
			(*result after 0->1 leading
edge from start:
16#77274F06*)
	END_VAR

POU body

When the variable bStart is set to TRUE, the function is carried out.

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_7SEGMENT!,,12,1,20,5,,?DEN?D@'s'?AENO?Cd);
B(B_CONTACT,,bStart,7,2,9,4,);
B(B_VARIN,,wInput_value,10,3,12,5,);
B(B_VAROUT,,wOutput_value,20,3,22,5,);
L(1,3,7,3);
L(9,3,12,3);
L(1,0,1,6);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

IF bStart then
    FP_7SEGMENT(s := wInput_value, d => wOutput_value);
END_IF;

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