Passa al contenuto principale

DoublesToLong, double to long conversion

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​

Immagine funzione DoublesToLong

ParametroTipoDescrizione
MSDWDWORDMSDW del valore in uscita.
LSDWDWORDLSDW del valore in uscita.
OutLWORDLa 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]