Vai all indice del manuale di programmazione
Tipo:
Funzione
Libreria LogicLab:
eLLabUtyLib
Libreria Codesys:
Non disponibile
Questa funzione permette di convertire due variabili DWORD in una variabile LWORD. L’operando MSDW è trasferito nei 32 bits alti, l’operando LSDW è trasferito nei 32 bits bassi.
Descrizione
MSDW (DWORD) MSDW del valore in uscita.
LSDW (DWORD) LSDW del valore in uscita.
La funzione ritorna una LWORD.

Esempi
Come utilizzare gli esempi.
Nell’esempio due variabili DWORD con valore 16#1234567 e 16#89ABCDEF sono trasferite in una variabile LWORD il risultato sarà 16#123456789ABCDEF.
LogicLab (Ptp114, ST_WordsToDouble)
PROGRAM ST_DoublesToLong
VAR
High : DWORD := 16#1234567; (* MSDW double word *)
Low : DWORD := 16#89ABCDEF; (* LSDW double word *)
Result : ARRAY[0..1] OF LWORD; (* Compress result *)
END_VAR
// *****************************************************************************
// PROGRAM "ST_DoublesToLong"
// *****************************************************************************
// This program shows the use of DoublesToLong function.
// -----------------------------------------------------------------------------
// -------------------------------------------------------------------------
// COMPRESS WORD
// -------------------------------------------------------------------------
// Compress byte using the FB.
Result[0]:=DoublesToLong(High, Low); //Compress result
// -------------------------------------------------------------------------
// COMPRESS WORD
// -------------------------------------------------------------------------
// The same operation as above executed directly using ST statements.
Result[1]:=(TO_DWORD(High)*16#100000000)+TO_DWORD(Low); //Compress result
// [End of file]