CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

18f4331 PWM Dead time

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
lokeshbhatt



Joined: 16 Mar 2010
Posts: 11

View user's profile Send private message Send e-mail

18f4331 PWM Dead time
PostPosted: Mon Jul 19, 2010 6:19 am     Reply with quote

Hi,
In 18f4331 how to generate 3phase ac signal? Below is the program
but it is not showing dead time in between complementary output & now we know 3phase AC require 3 different waves so how can we get...
Code:
 
#include<18f4431.h>
//#device PIC18f4331*=8 ADC=8 ICD=TRUE

#use delay(clock=4000000)
//#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)

#int_PWMTB
void PWMTB_isr()
{
    setup_power_pwm_pins(PWM_COMPLEMENTARY,PWM_COMPLEMENTARY,PWM_COMPLEMENTARY,PWM_OFF);
   set_power_pwm2_duty(100);
   set_power_pwm4_duty(100);
   clear_interrupt(int_PWMTB);
}
 

void main()
{
   /*********************************************************************************
   ******   This Program to generate PWM outputs and what are all registers need to
   ******   be set for that are as follows.......
   1.
      Parameters :

   1. PTCON0 (Timer Control Reg)
      Parameters : freerunning, Prescaling 1:1, Postscaling 1:1
   2. PTCON1 (Timer Control Reg) 0xC0
      Parameters : Count Up,TimeBase ON
   3. PWMON0 (PWM ON )
      Parameters :PWM ON 0 & 1, Complementary
   4. PWMCON1 ()
      Parameters :
   5. PTPER (Time Period )
      Parameters :   
            
   
   
   */
   enable_interrupts(INT_PWMTB);
   enable_interrupts(GLOBAL);

   set_power_pwm0_duty(PWM_UPDATE_ENABLE);
   
   set_power_pwm_override(1, true, 1);
    setup_power_pwm_pins(PWM_COMPLEMENTARY,PWM_OFF,PWM_OFF,PWM_OFF);
      //PPWM channels 0 and 1 are both on and always opposite values
   setup_power_pwm(PWM_CLOCK_DIV_4|PWM_FREE_RUN|PWM_DEAD_CLOCK_DIV_4,400,0,500,0,1,200);
      //add dead time for reactive loads
   set_power_pwm0_duty(400);
   set_power_pwm2_duty(400);
   set_power_pwm4_duty(400);

   while(TRUE);
}

_________________
Thanks & Regards
Lokesh Bhatt
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group