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

make PIC 18F452 working in real time

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



Joined: 06 May 2012
Posts: 2

View user's profile Send private message

make PIC 18F452 working in real time
PostPosted: Sun May 06, 2012 5:40 am     Reply with quote

I am developing project using PIC18f452 I want pic operate an operation (step motor) for 20minutes not for non-ending loop , how i can do it ?
_________________
MKA
Ttelmah



Joined: 11 Mar 2010
Posts: 19513

View user's profile Send private message

PostPosted: Sun May 06, 2012 8:28 am     Reply with quote

This is really just basic programming.

Instead of structuring your code as:

do what you want forever

Structure your code as:

do what you want until a time has passed
then sit and wait.

How you work out that the 'time has passed', would depend on how your stepper motor code is written. For instance, if it is a loop controlling a pulse train to a stepper, with a pulse being sent every 1mSec for example, then you could just loop for 20000 times. If however it doesn't have a fundamental 'time', then you can just use one of the timers to generate a clock, and wait till this shows the time has passed, or add an external chip, with a programmable 'alarm', and use this as the signal.

Best Wishes
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