Level: Rookie

Joined: Sat. Aug 13, 2016

Posted by Emrah Duatepe:
Thu. Nov 14, 2019 - 06:44 AM
Hiy guys, I am trying to understand how to use sinusoidal control.I have codes someone did it. But I couldn't understand somewhere maybe someone have this experience ,maybe can understand the basic points that I can continue.If you need all codes I can send bu very long this is why I am gonna send specific points.

int_sine_temp>>=10; this is interesting.What is it?

static void tc_tcc0_ovf_callback(void)
{
unsigned long long_temp=0;
pwm_step++;
switch (pwm_step)
{
case 1:
{
int_sine_temp=pgm_read_word(&torq_num2[k_a]);
int_sine_temp*=motor_volt;
int_sine_temp>>=10;
int_sine_temp+=half_capture_compare;
TCC0_CCBBUF=int_sine_temp;
int_sine_temp=pgm_read_word(&torq_num2[k_b]);
int_sine_temp*=motor_volt; ///4;
int_sine_temp>>=10;
int_sine_temp+=half_capture_compare;
TCC0_CCABUF=int_sine_temp;
int_sine_temp=pgm_read_word(&torq_num2[k_c]);
int_sine_temp*=motor_volt; ///4;
int_sine_temp>>=10;
int_sine_temp+=half_capture_compare;
TCC0_CCCBUF=int_sine_temp;
motor_amp_temp2+=adc_read(_motor_amp_pin);
motor_amp_temp2/=2;
motor_amp_temp=motor_amp_temp2;
}
//.
//.
//.
//Code has more
}

This topic has a solution. Jump to the solution.

## Tags:

Last Edited: Thu. Nov 21, 2019 - 06:27 AM