Forum Discussion
Altera_Forum
Honored Contributor
11 years agoI now realized why my pwm signal was so "strange"
I did not scale the sine correct to the triangle counter. I switched back to count from 0 to 100. And the i multiplied each sine value with 50 and added an offset of 50 to it. Now i have the desired output signal. Thank you both for your help and time!! I did not follow the NCO idea because i did not fully understand the principals (-; Cheers Timfunction init_table return table is
variable x: real;
variable var: table;
begin
for i in 0 to 499 loop
x:= SIN(real(i)*2.0*MATH_PI/500.0);
var(i):=std_logic_vector(to_signed(INTEGER(50.0 + x*50.0),10));
end loop;
return var;
end;
constant sinTable : table := init_table;