Hi, for understanding purpose i have done the following to drive a motor. Please tell me which portions are absolutely wrong and which are to be modified. I have created a sine look up table and in a timer interrupt of 10ms i am loading one value each upto 256. So it is a kind of from 0 degrees to 360 degrees so one degree each every 10ms interrupt. To drive the legs for switching a vague method i have created is calculate the difference between previous voltage to present voltage and increase the duty cycle by some value of 20. I plan to change this switching sequence. I can see the motor rotating. Please suggest.
The concept seems correct at all, I used the same look-up logic with an inverter. I'm assuming you mean by 256 to the maximum allowed value to the duty-cycle register of some PWM module.
To drive the legs for switching a vague method i have created is calculate the difference between previous voltage to present voltage and increase the duty cycle by some value of 20.
There are issues on this method; the most critical is that you are using a constant correction value instead of using some kind of loopback control proportional to the difference.
The concept seems correct at all, I used the same look-up logic with an inverter. I'm assuming you mean by 256 to the maximum allowed value to the duty-cycle register of some PWM module.
There are issues on this method; the most critical is that you are using a constant correction value instead of using some kind of loopback control proportional to the difference.
Many unclear points. Your are initially talking about a sine look-up table, but Sinewave() seems to calculate three phase voltages on the fly. The calculation is expectable very slow, probably taking a multiple of 10 ms, depending on the processor power.
Also what's the intended speed? 256 steps per 360° and 10 ms step rate gives only 23 rpm / number of pole pairs.
I am sorry for not being very clear. Actually i am trying to generate three sine waves 120 apart for three phases. Now i want to switch the legs based on this voltage but don't know how to do it. I want to acheive this by pwm.