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

Delay_us() variable greater than 255?

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



Joined: 09 Jun 2004
Posts: 52

View user's profile Send private message

Delay_us() variable greater than 255?
PostPosted: Tue Nov 16, 2010 2:06 pm     Reply with quote

My code needs to make calculations for delays that are more than the 255 allowed when using a variable.

Is there any (easy) way to have my program make the calculation, then have that multi-thousand uSec delay?

Cheers,
Steve
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Nov 16, 2010 2:24 pm     Reply with quote

I'm not sure what you're asking for. Do you have an older version of the
compiler (vs. 3.xxx) that doesn't support variable delays larger than 255,
and you need a work-around ? Or, are you asking for some way to
convert usec delays into milliseconds ? Are you asking for some
alternative delay method ?
Douglas Kennedy



Joined: 07 Sep 2003
Posts: 755
Location: Florida

View user's profile Send private message AIM Address

PostPosted: Tue Nov 16, 2010 2:26 pm     Reply with quote

Use two variables one under 255 for the delay and the other to control the number of times delay is called from within a loop.
Alternatively delay will take a constant bigger than 255 so if you can accept a certain graininess use one big delay several times in your loop.
eyewonder300



Joined: 09 Jun 2004
Posts: 52

View user's profile Send private message

Clarificaiton
PostPosted: Tue Nov 16, 2010 2:39 pm     Reply with quote

The compiler I am using is 4.069. I have been using an old manual that says the range of a variable that could be passed is 0-255, and that a constant could be up to 65535.

What my code does is calculate a delay - ex 6666uSec, in an int16 variable 'new_delay'. What I want is to be able to do is have the program make that calculation, then execute a 'delay_us(new_delay)' for a 6,666uSec delay.

I did not try that, as my old manual indicated that it would not work.

Does my current compiler do what I want?

Thanks,

Steve
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Nov 16, 2010 2:46 pm     Reply with quote

Compiler vs. 4.069 was released on about March 3, 2008.
You could use the June 2008 manual:
http://www-pagines.fib.upc.es/~sdmi/pdfs/Manual_CCS.pdf
But hyperlinks don't work in that one, so it's not fun to use.

You could use the June 2010 manual:
http://www.ccsinfo.com/downloads/ccs_c_manual.pdf
eyewonder300



Joined: 09 Jun 2004
Posts: 52

View user's profile Send private message

Non-problem solved
PostPosted: Tue Nov 16, 2010 2:54 pm     Reply with quote

Thanks, PCM et al. Looking at a much newer manual told me that I could do exactly what I wanted.

Cheers,
Steve
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