F131_BTR

Resetta bit di un dato a 16 bit

Imposta su FALSE 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

n (INT)

Specifica la posizione bit da resettare

Uscita

d (WORD, INT, UINT)

area a 16 bit

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
		bReset: BOOL:=FALSE;
			(*activates the function*)
		iValue: INT:=2;
			(*bit position*)
		wWord: WORD:=2#10101;
			(*result after a 0->1 leading
edge from start: 2#10001*)
	END_VAR

Corpo del POU

Quando la variabile bReset è impostata su TRUE, la funzione viene eseguita. Il bit alla posizione 2 viene resettato su 0.

Corpo LD

BODY
    WORKSPACE
        NETWORK_LIST_TYPE := NWTYPELD ;
    END_WORKSPACE
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 5 ;
        NETWORK_BODY
B(B_CONTACT,,bReset,3,1,5,3,);
B(B_F,F131_BTR!,,9,0,15,4,,?DEN?Dn?AENO?Cd);
B(B_VARIN,,iValue,7,2,9,4,);
B(B_VAROUT,,wWord,15,2,17,4,);
L(1,0,1,5);
L(1,2,3,2);
L(5,2,9,2);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

Corpo ST

IF bReset then
    F131_BTR( n:= iValue,
         d=> wWord);
END_IF;

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