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.

# CCS/TMDSCNCD28035: TDPV1000E0C1: in the main code what are these numbers come from?

Part Number: TMDSCNCD28035
Other Parts Discussed in Thread: CONTROLSUITE

Tool/software: Code Composer Studio

Hello my dear Friends

I am working on TDPV1000E0C1, I noticed in the code for 50 Hz and 60 Hz, TI takes some constant numbers, I don't know where it came from can you please help me out. I have shared the screenshot for a better understanding.

Thanks

Avi

• This is the sine table for 50Hz.

Shamim

• Thank you Shamim for the answer, I am wondering what is the math behind these numbers? because I need to make this table for 400 Hz.

Thanks

Avi

• sgen_mdl.pdf

The documentation is in ControlSUITE. Attached is a copy. The section to read is the SGEN using lookup table

Shamim

• Hey Shamim,

I have read that but I have a question regarding the numbers,

1) why the difference is 268 for 50 Hz and 322 for 60 Hz

2) Why the maximum number is 65268 for 50 hz and 65214 for 60 hz

I am a beginner at this, this is the code......

const unsigned int wSinTab[]={ //for 50Hz system

0, 268, 536, 804, 1071, 1339, 1606, 1872, 2138,
2404, 2669, 2934, 3196, 3459, 3720, 3981, 4240, 4499,
4756, 5012, 5266, 5519, 5771, 6021, 6269, 6516, 6761,
7005, 7246, 7485, 7723, 7958, 8191, 8423, 8651, 8878,
9102, 9323, 9543, 9759, 9973, 10185, 10393, 10599, 10802,
11002, 11199, 11393, 11585, 11773, 11957, 12139, 12317, 12492,
12664, 12834, 12997, 13159, 13317, 13471, 13622, 13769, 13912,
14052, 14188, 14320, 14449, 14573, 14693, 14810, 14923, 15031,
15136, 15236, 15333, 15425, 15513, 15598, 15677, 15753, 15825,
15892, 15955, 16014, 16068, 16118, 16164, 16206, 16243, 16276,
16304, 16328, 16348, 16363, 16374, 16381, 16383,

16381, 16374, 16363, 16348, 16328, 16304,
16276, 16243, 16206, 16164, 16118, 16068, 16014, 15955, 15892,
15825, 15753, 15677, 15598, 15513, 15425, 15333, 15236, 15136,
15031, 14923, 14810, 14693, 14573, 14449, 14320, 14188, 14052,
13912, 13769, 13622, 13471, 13317, 13159, 12997, 12834, 12664,
12492, 12317, 12139, 11957, 11773, 11585, 11393, 11199, 11002,
10802, 10599, 10393, 10185, 9973, 9759, 9543, 9323, 9102,
8878, 8651, 8423, 8191, 7958, 7723, 7485, 7246, 7005,
6761, 6516, 6269, 6021, 5771, 5519, 5266, 5012, 4756,
4499, 4240, 3981, 3720, 3459, 3196, 2934, 2669, 2404,
2138, 1872, 1606, 1339, 1071, 804, 536, 268, 0 ,

65268, 65000, 64732, 64465, 64197, 63930, 63664, 63398,
63132, 62867, 62602, 62340, 62077, 61816, 61555, 61296, 61037,
60780, 60524, 60269, 60017, 59765, 59515, 59267, 59020, 58775,
58531, 58290, 58051, 57813, 57578, 57345, 57113, 56885, 56658,
56434, 56213, 55993, 55777, 55563, 55351, 55143, 54937, 54734,
54534, 54337, 54143, 53951, 53763, 53579, 53397, 53219, 53044,
52872, 52702, 52539, 52377, 52219, 52065, 51914, 51767, 51624,
51484, 51348, 51216, 51087, 50963, 50843, 50726, 50613, 50505,
50400, 50300, 50203, 50111, 50023, 49938, 49859, 49783, 49711,
49644, 49581, 49522, 49468, 49418, 49372, 49330, 49293, 49260,
49232, 49208, 49188, 49173, 49162, 49155, 49153,

49155, 49162, 49173, 49188, 49208, 49232,
49260, 49293, 49330, 49372, 49418, 49468, 49522, 49581, 49644,
49711, 49783, 49859, 49938, 50023, 50111, 50203, 50300, 50400,
50505, 50613, 50726, 50843, 50963, 51087, 51216, 51348, 51484,
51624, 51767, 51914, 52065, 52219, 52377, 52539, 52702, 52872,
53044, 53219, 53397, 53579, 53763, 53951, 54143, 54337, 54534,
54734, 54937, 55143, 55351, 55563, 55777, 55993, 56213, 56434,
56658, 56885, 57113, 57345, 57578, 57813, 58051, 58290, 58531,
58775, 59020, 59267, 59515, 59765, 60017, 60269, 60524, 60780,
61037, 61296, 61555, 61816, 62077, 62340, 62602, 62867, 63132,
63398, 63664, 63930, 64197, 64465, 64732, 65000, 65268};
//----------------------------------------------------------------------------------

/*const unsigned int wSinTab[]={ //for 60Hz system

0, 322, 643, 965, 1285, 1606, 1926, 2245,
2563, 2880, 3196, 3511, 3825, 4137, 4447, 4756,
5063, 5368, 5671, 5971, 6270, 6566, 6859, 7150,
7438, 7723, 8006, 8285, 8561, 8833, 9102, 9368,
9630, 9889, 10143, 10394, 10641, 10883, 11121, 11356,
11585, 11810, 12031, 12247, 12458, 12665, 12867, 13063,
13255, 13441, 13623, 13799, 13970, 14135, 14295, 14449,
14598, 14741, 14879, 15011, 15137, 15257, 15371, 15480,
15582, 15679, 15769, 15853, 15931, 16003, 16069, 16129,
16182, 16229, 16270, 16305, 16333, 16356, 16371, 16381,
16384,

16381, 16371, 16356, 16333, 16305, 16270, 16229, 16182,
16129, 16069, 16003, 15931, 15853, 15769, 15679, 15582,
15480, 15371, 15257, 15137, 15011, 14879, 14741, 14598,
14449, 14295, 14135, 13970, 13799, 13623, 13441, 13255,
13063, 12867, 12665, 12458, 12247, 12031, 11810, 11585,
11356, 11121, 10883, 10641, 10394, 10143, 9889, 9630,
9368, 9102, 8833, 8561, 8285, 8006, 7723, 7438,
7150, 6859, 6566, 6270, 5971, 5671, 5368, 5063,
4756, 4447, 4137, 3825, 3511, 3196, 2880, 2563,
2245, 1926, 1606, 1285, 965, 643, 322, 0,

65214, 64893, 64571, 64251, 63930, 63610, 63291, 62973,
62656, 62340, 62025, 61711, 61399, 61089, 60780, 60473,
60168, 59865, 59565, 59266, 58970, 58677, 58386, 58098,
57813, 57530, 57251, 56975, 56703, 56434, 56168, 55906,
55647, 55393, 55142, 54895, 54653, 54415, 54180, 53951,
53726, 53505, 53289, 53078, 52871, 52669, 52473, 52281,
52095, 51913, 51737, 51566, 51401, 51241, 51087, 50938,
50795, 50657, 50525, 50399, 50279, 50165, 50056, 49954,
49857, 49767, 49683, 49605, 49533, 49467, 49407, 49354,
49307, 49266, 49231, 49203, 49180, 49165, 49155, 49152,

49155, 49165, 49180, 49203, 49231, 49266, 49307, 49354,
49407, 49467, 49533, 49605, 49683, 49767, 49857, 49954,
50056, 50165, 50279, 50399, 50525, 50657, 50795, 50938,
51087, 51241, 51401, 51566, 51737, 51913, 52095, 52281,
52473, 52669, 52871, 53078, 53289, 53505, 53726, 53951,
54180, 54415, 54653, 54895, 55142, 55393, 55647, 55906,
56168, 56434, 56703, 56975, 57251, 57530, 57813, 58098,
58386, 58677, 58970, 59266, 59565, 59865, 60168, 60473,
60780, 61089, 61399, 61711, 62025, 62340, 62656, 62973,
63291, 63610, 63930, 64251, 64571, 64893, 65214};*/
//----------------------------------------------------------------------------------

Thanks

Avi

• It all depend on the Sinewave frequency range, the sampling frequency (your calculation loop frequency), the number of total data points and the step size. These information is in public domain. Lots of articles available. Please read/review those.

Shamim

• If you just step through with a constant time increment you may or may not hit the peak.

Try it. Get a particular set of times: .1, .2,.3...

And then calculate the sine values at those times: sin(2*pi*f*t) for various values of f.

• Thank you so much, Shamim for your help. I am very beginner in this field, will you suggest some resources which I refer to and learn? It would be a great help to me.

Regards

Avi

• Thank you so much, Keith