FP_DEG

Angle units (radians -> degrees) conversion

This FP instruction converts the value of an angle entered at input s from radians to degrees and returns the result at output d.

Parameters

Input

s (ANY_REAL)

Angle value

Output

d (ANY_REAL)

Converted angle value

Error flags

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

  • if s is not a REAL number

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

  • if s is not a REAL number

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*)
		rInput_value: REAL:=1.570796;
			(*corresponds to PI/2*)
		rOutput_value: REAL:=0.0;
			(*result after a 0->1 leading
edge from start: 89.9999
corresponds to 89,9999°*)
	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 := 5 ;
        NETWORK_BODY
B(B_F,FP_DEG!,,15,1,21,5,,?DEN?D@'s'?AENO?Cd);
B(B_CONTACT,,bStart,9,2,11,4,);
B(B_VARIN,,rInput_value,13,3,15,5,);
B(B_VAROUT,,rOutput_value,21,3,23,5,);
L(1,3,9,3);
L(11,3,15,3);
L(1,0,1,5);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

IF bStart THEN         
    FP_DEG(s := rInput_value, d => rOutput_value);
END_IF;

Modified on: 2022-08-23Feedback on this pagePanasonic hotline