This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

What is the conversion equation IQ24

Part Number: C2000WARE

Tool/software:

My colleagues shared his code, how he convert the hex value we poll from the device and convert into an actual value.

Below is the code he send me, but I'm using a different programming language called LabVIEW, so if any help can be provided I would be appreciated.

//----------------------------------------------------------

// From the TI library header file:

// Pretty sure that _iq equates to _iq24 in our usage

typedef   long    _iq;

typedef   long    _iq24;

 

//--------------------------------------------

// From the 9012

// The values are pulled from this structure

struct CommsDetType

{

    _iq iqTxAmplitude;

    _iq iqNaAmplitude;

    _iq iqFrequencyEstimate;

    _iq iqHitThreshold;

 

    // noise tracking

    _iq TxMean;

    _iq NaMean;

};

 

    // Psuedo code

    for (coil = 0; coil < 2; coil++)

    {

        for (phase = 0; phase < 3; phase++)

        {

            TxMean;

            pPkt += 4;

 

            NaMean;     //NA = Noise Average

            pPkt += 4;

 

            iqHitThreshold;

            pPkt += 4;

 

            iqTxAmplitude;

            pPkt += 4;

 

            iqNaAmplitude;

            pPkt += 4;

        }

    }

11:44:12:533: TX ==> GET_SYSTEM_ENV_DATA: 0 fd 0 57 54
11:44:12:589: RX <== GET_SYSTEM_ENV_DATA: fd 0 78 57 0 18 6d 7d 0 0 36 af 0 0 fa e3 0 0a 87 76 0 0 6 47 0
11:44:12:626: TX ==> GET_SYSTEM_ENV_DATA: 0 fd 0 57 54
11:44:12:685: RX <== GET_SYSTEM_ENV_DATA: fd 0 78 57 0 18 73 4 0 0 36 a9 0 0 fa f5 0 16 f8 48 0 0 c5 df 0
11:44:12:720: TX ==> GET_SYSTEM_ENV_DATA: 0 fd 0 57 54
11:44:12:779: RX <== GET_SYSTEM_ENV_DATA: fd 0 78 57 0 18 6f ab 0 0 36 bc 0 0 fa bb 0 16 a8 51 0 0 48 fc 0
11:44:12:814: TX ==> GET_SYSTEM_ENV_DATA: 0 fd 0 57 54
11:44:12:859: RX <== GET_SYSTEM_ENV_DATA: fd 0 78 57 0 18 71 6f 0 0 36 c0 0 0 fa 61 0 0e 90 e4 0 0 fb 8c 0
11:44:12:894: TX ==> GET_SYSTEM_ENV_DATA: 0 fd 0 57 54
11:44:12:939: RX <== GET_SYSTEM_ENV_DATA: fd 0 78 57 0 18 6f c4 0 0 93 7e 0 1 4a 22 0 1a 1a 47 0 0 0f da 0
11:44:12:987: RX <== MSG_ACK_NEW_EVENT: fd 0 2 24 11 0 34
11:44:13:018: TX ==> GET_STATUS: 0 fd 1 28 2 28
11:44:13:035: RX <== GET_STATUS: fd 0 2 28 2 0 29
11:44:13:066: TX ==> GET_SYSTEM_ENV_DATA: 0 fd 0 57 54
11:44:13:114: RX <== GET_SYSTEM_ENV_DATA: fd 0 78 57 0 18 73 a8 0 0 36 ae 0 0 f9 f0 0 0f 27 ff 0 0 13 25 0
11:44:13:143: TX ==> GET_SYSTEM_ENV_DATA: 0 fd 0 57 54
11:44:13:194: RX <== GET_SYSTEM_ENV_DATA: fd 0 78 57 0 18 75 67 0 0 36 a4 0 1 49 c2 0 8 0 9 0 0 3d 46 0
11:44:13:220: TX ==> GET_SYSTEM_ENV_DATA: 0 fd 0 57 54
11:44:13:274: RX <== GET_SYSTEM_ENV_DATA: fd 0 78 57 0 18 77 f9 0 0 36 ad 0 0 f9 3 0 0e 9e 1f 0 1 1b e5 0
11:44:13:297: TX ==> GET_SYSTEM_ENV_DATA: 0 fd 0 57 54
11:44:13:354: RX <== GET_SYSTEM_ENV_DATA: fd 0 78 57 0 18 78 d7 0 0 36 a8 0 0 f8 6b 0 11 e1 66 0 0 0a 72 0
11:44:13:377: TX ==> GET_SYSTEM_ENV_DATA: 0 fd 0 57 54
11:44:13:434: RX <== GET_SYSTEM_ENV_DATA: fd 0 78 57 0 18 7e 9e 0 0 36 a3 0 0 f7 80 0 17 2 99 0 0 ff c5 0
11:44:13:456: TX ==> GET_SYSTEM_ENV_DATA: 0 fd 0 57 54
11:44:13:514: RX <== GET_SYSTEM_ENV_DATA: fd 0 78 57 0 18 7a aa 0 0 36 ad 0 0 f6 d3 0 16 bb fc 0 0 71 e2 0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
Start Point
  TX Mean       NA Mean       Det Threshold       Tag Energy         Noise Energy  
Real Value => 47dB 5dB
14:14:28:941: RX <== GET_SYSTEM_ENV_DATA: fd 0 78 57 0 0a 36 5a 0 0 8e 27 0 1 e0 a8 0 9 3f 74 0 0 c8 dd 0
14:14:28:976: TX ==> GET_SYSTEM_ENV_DATA: 0 fd 0 57 54
14:14:29:021: RX <== GET_SYSTEM_ENV_DATA: fd 0 78 57 0 0a 3a 72 0 0 88 b0 0 1 db 78 0 9 ac be 0 1 12 79 0
14:14:29:053: TX ==> GET_SYSTEM_ENV_DATA: 0 fd 0 57 54
14:14:29:100: RX <== GET_SYSTEM_ENV_DATA: fd 0 78 57 0 0a 39 57 0 0 93 1f 0 1 e6 2e 0 9 9 e1 0 0 18 ed 0
14:14:29:130: TX ==> GET_SYSTEM_ENV_DATA: 0 fd 0 57 54
14:14:29:179: RX <== GET_SYSTEM_ENV_DATA: fd 0 78 57 0 0a 3d 5c 0 0 8e 3e 0 1 e1 94 0 9 15 b0 0 0 c0 30 0
14:14:29:209: TX ==> GET_SYSTEM_ENV_DATA: 0 fd 0 57 54
14:14:29:258: RX <== GET_SYSTEM_ENV_DATA: fd 0 78 57 0 0a 40 62 0 0 8c 69 0 1 df b3 0 9 9 c6 0 0 11 34 0
14:14:29:285: TX ==> GET_SYSTEM_ENV_DATA: 0 fd 0 57 54
14:14:29:338: RX <== GET_SYSTEM_ENV_DATA: fd 0 78 57 0 0a 3f 5d 0 0 94 9f 0 1 e8 1 0 9 54 22 0 0 b2 3 0
14:14:29:364: TX ==> GET_SYSTEM_ENV_DATA: 0 fd 0 57 54
14:14:29:418: RX <== GET_SYSTEM_ENV_DATA: fd 0 78 57 0 0a 43 68 0 0 8f 67 0 1 e2 f2 0 9 42 6c 0 0 c6 8 0
14:14:29:442: TX ==> GET_SYSTEM_ENV_DATA: 0 fd 0 57 54
14:14:29:498: RX <== GET_SYSTEM_ENV_DATA: fd 0 78 57 0 0a 42 61 0 0 93 a0 0 1 e6 de 0 9 36 97 0 0 3a 15 0
14:14:29:534: TX ==> GET_SYSTEM_ENV_DATA: 0 fd 0 57 54
14:14:29:593: RX <== GET_SYSTEM_ENV_DATA: fd 0 78 57 0 0a 45 52 0 0 97 80 0 1 ea ca 0 9 47 98 0 0 df f9 0
14:14:29:626: TX ==> GET_SYSTEM_ENV_DATA: 0 fd 0 57 54
14:14:29:673: RX <== GET_SYSTEM_ENV_DATA: fd 0 78 57 0 0a 49 66 0 0 8f 8b 0 1 e2 e1 0 9 62 c9 0 0 b4 60 0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
Start Point
  TX Mean       NA Mean       Det Threshold       Tag Energy         Noise Energy  

Basically,

18 73 a8 0
18 75 67 0
18 77 f9 0
18 78 d7 0
18 7e 9e 0

this will all result a 47 dB, so I would like to know how the conversion is done from the hex to q value.

  • Hello,

    Apologies for the delay. This expert is currently out of office until 10/1. I will try to see if another colleague can answer in the meantime, but please expect a delay in response until then.

    Best Regards,

    Allison
  • IQx uses signed 2's complement format with a "virtual decimal" at the xth bit. So for a 32-bit IQ24 number:

    • signed 2's complement, bit 32 is the sign
    • bits to the left of the "decimal" have a weight of 2^n (so bit 25 has a weight of 2^1 = 2, bit 26 = 2^2 = 4, bit 27 = 2^3 = 8 .... bit 31 = 2^7 = 64.
    • To the right of the decimal is fractional bits. (bit 24 = 1/2^1 = .5, bit 23 = .25 etc...)

    -L

  • Can you elaborate a little more, just add all the value up? 

    For Instance => 0A 43 68 00 => 00001010010000110110100000000000 =>

    32th bit is a 0, which indicates positive number => Then the next 8 bits, will be 2^2, 2^4, giving a result 4 and 16, do I just add the values? 

     

  • Huang,

    I am sorry I missed this thread. There was a re-assignment, but I didn't get the system notification. I will reply to this by Monday.

    Again, my apologies.

    Thanks,

    Sira