F130_BTS

Imposta bit di un dato a 16 bit

Imposta su TRUE il bit specificato dalla posizione bit in n del dato a 16 bit specificato da d se il trigger EN è in stato TRUE. I bit diversi dal bit specificato non cambiano. L'intervallo di n va da 0 a 15.

Parametri

Ingresso

d (WORD, INT, UINT)

area a 16 bit

Uscita

n (INT)

Specifica la posizione bit da impostare

Esempio

Intestazione del POU

Tutte le variabili di ingresso e uscita utilizzate per programmare questa funzione sono state dichiarate nell'intestazione del POU. La stessa intestazione del POU è utilizzata per tutti i linguaggi di programmazione.

	VAR
		bSet: BOOL:=FALSE;
			(*activates the function*)
		iValue: INT:=0;
			(*bit position*)
		wWord: WORD:=2#101010;
			(*result after a 0->1 leading
edge from start: 2#101011*)
	END_VAR

Corpo del POU

Quando la variabile bSet è impostata su TRUE, la funzione viene eseguita. Il bit alla posizione 0 viene impostato su 1.

Corpo LD

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_CONTACT,,bSet,3,1,5,3,);
B(B_VARIN,,iValue,8,2,10,4,);
B(B_VAROUT,,wWord,16,2,18,4,);
B(B_F,F130_BTS!,,10,0,16,4,,?DEN?Dn?AENO?Cd);
L(5,2,10,2);
L(1,2,3,2);
L(1,0,1,5);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

Corpo ST

IF bSet then
    F130_BTS( n:= iValue,
         d=> wWord);
END_IF;

Corpo IL

LD

start

(* EN = start; Starting signal for the F130_BTS function. *)

F130_BTS

output_value,

(* n = output_value *)

0

(* d = bit number, here 0 *)

ST

out

(* optional *)

L'ultima revisione: 2021-06-21Feedback su questa paginaPanasonic hotline