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 CCS Technical Support

PWM (for sine wave )

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



Joined: 17 Sep 2007
Posts: 9
Location: Chennai-India

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

PWM (for sine wave )
PostPosted: Thu Sep 20, 2007 1:28 am     Reply with quote

hi...

I sent some sine wave index(99 values for one half cycle). I need for sent index value equal to 10ms

this my program

for (index =0; index<99; index++)
{
set_pwm1_duty( pwmtab[index] );
set_pwm2_duty( pwmtab[index] );

if ( index == 98 )
{
index = 0;
}
}


I need for sent all index values equal to 10msec time.

pls help me sir
libor



Joined: 14 Dec 2004
Posts: 288
Location: Hungary

View user's profile Send private message

PostPosted: Thu Sep 20, 2007 1:39 am     Reply with quote

If you include a delay_ms(10); instruction in your loop then each value will be active for 10 ms.
Guest








Re: PWM (for sine wave )
PostPosted: Thu Sep 20, 2007 1:23 pm     Reply with quote

pandi wrote:
hi...

i sent some sine wave index(99 values for one half cycle) . i need for sent index value equal to 10ms

this my program

for (index =0; index<99; index++)
{
set_pwm1_duty( pwmtab[index] );
set_pwm2_duty( pwmtab[index] );

if ( index == 98 )
{
index = 0;
}
}


i need for sent all index values equal to 10msec time

pl help me sir

Set up a timer to interrupt every 10mS ... Then in the Timer ISR just set a flag. Don;t make the mistake of trying to do too much stuff in the ISR.
monitor the flag and when it's set output the next value, then clear the flag and wait for the next.
I posted a rough outlie of the code in a previous posting...
ELCouz



Joined: 18 Jul 2007
Posts: 427
Location: Montreal,Quebec

View user's profile Send private message

PostPosted: Fri Sep 21, 2007 2:50 am     Reply with quote

double post... http://ccsinfo.com/forum/viewtopic.php?t=32134
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