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.

TMS320F28379D: Why the values are not changing?

Part Number: TMS320F28379D

Hi everyone,

I want to generate three values that are changing over time by changing "theta" as the phase. V2_ref is following the Cos waveform perfectly fine, but the "d" and "dd" values are fixed (If I exclude the "exp(h)" and "exp(hh)" functions, these two would also work). I would appreciate it if anyone could help me solve this problem.

Note: every parameter is a "float" except for the "h" and "hh" which are both double.

V2=40;
del_theta=((0xFFFF)*Freq*500*(0.00000001));
theta=theta+del_theta;


V2_ref[2]=(int16_t)V2*(cos((float)theta*0.000095875)); 


h=-b*pow(abs((float)theta*0.000095875-1),e);
d[2]=1-a*exp(h)+a*exp(-b*pow(1,e));


hh=-bb*pow(abs((float)theta*0.000095875-1),ee);

dd[2]=dd-aa*exp(hh);

if (theta==65535)
{
theta=0;
}

  • Payam,

    What are e and ee?

    What do you mean by this? "If I exclude the "exp(h)" and "exp(hh)" functions, these two would also work"

    You have a pow(1,e) which is 1^x, not sure why you have that in there.

    All float constants should be appended with f e.g. 0.000095875f

    Thanks,

    Sira

  • Thank you for your reply,
    so, a,b,d,e,aa,bb,dd,ee are some numbers that are defined by "float", previously.

    pow(1,e) is serving as one example and could be something else according to the situation (Which is changed manually).

    "h" and "hh" are defined as "double" and are varying with the variation of "theta".

    since "h" and "hh" are varying, d[2] and dd[2] should also vary; but, they remain fixed, which is where my problem is. However, if I change the"exp(h)" function with the "h" only in the definition of d[2], and the same thing in the definition of the dd[2], then d[2] and dd[2] will vary with the variation of the "h" and "hh", respectively.

    Best regards,

  • Can you define temporary variables for exp(h) and exp(hh) and check whether they are correct?