Floating point to fixed point and vice versa

This page describes and covers floating point to fixed point conversion and vice versa with floating to fixed point C code.

Following C program converts two separate I (real) and Q (imaginary) files from one format to the other as per the selection made. If you are converting from floating point to fixed point then real_in and imag_in files should be in floating point. Results will be written to files real_out and imag_out. Do create a macro header file by name macro1.h and save the contents mentioned below.

Following C program converts Hex number to integer format i.e. decimal and vice versa. It includes both positive and negative values. User need to change 32768 as highlighted in red to appropriate Q format as required for hex to integer conversion. This example is for Q format of 15. This is very useful program in order to convert Analog to Digital converter output in communication receiver chain to analyze and debug as most of the ADC gives out or writes hex data to interfaced memory on the board.

Follow following link to download the C code.
floating to fixed point and vice versa C code


Related Links

HEX to Decimal i.e. fixed point integer and vice versa.
hex-to-decimal C code

RF and Wireless tutorials

WLAN  802.11ac  802.11ad  wimax  Zigbee  z-wave  GSM  LTE  UMTS  Bluetooth  UWB  IoT  satellite  Antenna  RADAR