Basic Conversion Example

This text shows a basic data type conversion example in

QFIRE Studio

. All conversions preserve the 32-bit length.

Q15.16 data type

The

QFIRE CTR-101

works with 32-bit variables. Values returned by input or source blocks are formatted as a fixed-point Q15.16 data type. Q15.16 means that the Most Significant Bit is reserved for sign, the subsequent 15 bits for an integer number, and the remaining 16 bits for the fractional part. See Figure 1 for a visual binary representation of the number 1.75 in Q15.16 format.

Figure 1 - Example of the value of +1.75 in Q15.16 data type

U32 data type
Difference between U32 and U32SI

U32 means 32-bit unsigned integer. U32SI means 32-bit unsigned Stored Integer. These data types are commonly used with Boolean algebra blocks and are useful in parsing messages in data busses.

In Figure 2,  you can see the difference between U32 and U32SI.

Figure 2 - Q15.16 conversion to U32 and U32SI

Display 1 shows the same value that was sourced by the constant block because when you use the Q15.16 to U32 block, the conversion takes place by eliminating the 16 bits of the fractional part.  Due to this elimination, the information about the fractional part is lost in the conversion process. Therefore, the value is rounded down.

But Display 2, unlike Display 1, shows a different value. In this case, the conversion Q15.16 to U32SI block holds the 2 bytes of the fractional part and turns the sign bit into a value too. In other words, it takes the "Stored Integer" used by the format Q15.16 and handles it as an unsigned integer.

Split 32 bits in four groups of 8 bits

Figure 3 uses the block "U32 to BYTE" to split 32-bit data into four separate bytes from Least Significant Byte to the Most Significant Byte. It shows what is effectively stored in the memory after the conversion operations.

Figure 3 - Diagram showing difference between conversions

About MWF

MWF is a traditional Brazilian company that provides a wide range of electronic and mechatronic products for industry sectors such as automotive, agricultural machinery and aerospace.

Contact Us

Rua Doutor Siqueira, 139 / Sala 804 Campos dos Goytacazes - RJ, Brasil

contact@mwf-technologies.com

© 2018-2026 MWF. All rights reserved.