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

generating pulses.

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



Joined: 05 Sep 2007
Posts: 252

View user's profile Send private message

generating pulses.
PostPosted: Thu Nov 05, 2009 4:21 am     Reply with quote

Hi,
I want to generate pulses according to the values which are read by the keypad.
The pattern of pulses is like that what ever I entered a value from keypad it subtract 0.1 from that value, the value which comes after subtracting becomes ON_Time and the OFF_Time is 0.1

Suppose I have enter value 10.00 which is in seconds
ON_Time = (10 - 0.1) = 9.9 sec
OFF_Time = 0.1 sec

9.9 sec pulse is high and 0.1 sec pulse is low.

If value is entered 999.99 secs then
ON_Time = (999.99 - 0.1) = 999.89 sec
OFF_Time = 0.1 sec

Generate these pulses continuously for a certain amount of time.

Range of values entered from keypad is from 0.5 sec to 999.99 secs.


Any ideas.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Nov 05, 2009 1:29 pm     Reply with quote

Use a timer interrupt to create a software PWM generator. To find
routines for this, search the forum for: software PWM
Example:
http://www.ccsinfo.com/forum/viewtopic.php?t=37807

In main(), use a while() loop to call the CCS keypad driver, kbd.c.
Take the keypad input and use it to set the global pwm variables
which will be used inside the Timer interrupt routine to create
the desired PWM duty cycle and period.

You have to do this project. I don't want to do it for you.
hayee



Joined: 05 Sep 2007
Posts: 252

View user's profile Send private message

PostPosted: Fri Nov 06, 2009 10:43 pm     Reply with quote

Do you think that when i enter 999.99 sec it will generate pulses of (freq=1/999.99secs) using PWM.

if entered value is 0.5 sec,the frequency will be freq=1/.5sec =>2Hz
if entered value is 999.99sec,the freq will be freq=1/999.99sec => 0.001Hz

Is there any other way to do this without using PWM?
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