Because of the holidays, TI E2E™ design support forum responses will be delayed from Dec. 25 through Jan. 2. Thank you for your patience.

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.

IQMath sin table has 512 values or 1024 values??

Hi Guys,

I am using TMS32F28027 MCU. I wrote a simple code to test the sin table and then printed its values to a text file using Breakpoint method. Actually I am calling till 512, but the text file has 1024 values. I have attached the text file with this post.

My questions:

Array size of sin table, is it 512 or 1024?

Even if it has 1024 values, why is it saving all 1024 values to the text file? Because I am calling till 512 only(pls see CODE below).

The first three values stored in the text file are always garbage value(pls see text file), how to overcome this?

CODE:

void main(void)
{
   int  y = 0;   _iq x = _IQ(0);
    for(y = 0; y<512; y++){
        x = _IQ30toIQ(IQsinTable[y]);
    }
}

data.txt
Fullscreen
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
1651 3 8806 1 2 0
34020
34020
0
0
402
402
804
804
1206
1206
1607
1607
2009
2009
2410
2410
2811
2811
3211
3211
3611
3611
4011
4011
4409
4409
4808
4808
5205
5205
5602
5602
5997
5997
6392
6392
6786
6786
7179
7179
7571
7571
7961
7961
8351
8351
8739
8739
9126
9126
9512
9512
9896
9896
10278
10278
10659
10659
11039
11039
11416
11416
11793
11793
12167
12167
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Prakash,

    The file format you are saving is a .dat file format, where the first line shows a few details about the file itself. To learn about what these numbers mean, open CCS help and search for "data file formats".

    From that point and on, each value is duplicated. I don't exactly know what is the size of the type _iq (16 or 32 bits), but to me this indicates the values on the sin table are 16 bits but your code is duplicating these values when storing them to a 32-bit variable. Or perhaps the values are full 32-bits but the code is corrupting them.

    To validate this code, try to save the data directly from the sin table address using the Memory save option and compare the two.

    Hope this helps,
    Rafael
  • Hi desouza,

    Thanks for your reply. _iq is of type long. Global IQ is 15 and the IQsinTable returns IQ30 values. This duplication effect occurs only when writing the values of IQsinTable to a txt file.
    x = _IQ30toIQ(IQsinTable[y]);
    Instead of &x, I gave IQsinTable in the start address field, but all the values are 0. Any other suggestions?