How to use sine table

Status
Not open for further replies.

Muuhave

New Member
Hello,could you please show on how to generate that sine wave table values?I am confused will I need to use a positive half cycle of a complete cycle for 1 phase,I also have a problem of controlling an AC Three phase motor 11KW,could anyone help me to handle those codes in MicroC and provide an idea about power electronics of the system for controlling this?

See the codees here below I tried to make in MicroC:




Thank you!!
 
Code:
 sbit UP at RB1_bit; sbit DOWN at RB2_bit;
        const unsigned char sinetable[33] = {const unsigned char sine_table[33] = {0,24,48,69,88,104,115,123,125,123,115,104,88,69,48,24,0,-24,-48,-69,-88,-104,-115,-123,-125,-123,-115,-104,-88,-69,-48,-24,0,};

};
         unsigned short new_DC, newduty;
              char t,ii;
    void debounce()
            {
             delay_ms(300);
            }
void main()
{
   TRISA=0XFF;
   TRISC=0XF0;
   TRISB=0XF8;
   CCP1CON=0XC;
   PSTR1CON=0X1F;
   PR2=249;
   T2CON=4;
   T2CON.TMR2ON=1;
   T2CON.TMR2ON=1;
//PWM1CON=    For dead time programming
   PWM1_init(15000);      //Initialise PWM at 15KHZ
while(1){
    new_dc=0; 
       if(!(PORTA.B1)){
      debounce();
      if(new_dc<249)
      new_dc=new_dc+5;   //increment duty cycle
      }
       if(!PORTA.B2){
      debounce();
      if(new_dc!=0)
      new_dc=new_dc-5; //decrement duty cycle
           }
           if(newduty!=new_dc)
           {
           newduty=new_DC;
            PWM1_Start();
           PWM1_set_duty(sine_table[newduty]) ;

            }
          }
        }
 
Last edited:
A) Do not post multiple times as it will cause confusion.. We all view the entire site so it will be seen

B) Do not hijack other threads!! Its far easier and polite to create you own thread.... You effectively hijacked three threads... It won't get you more attention.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…