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

Question about using constants isnside delay_func()

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



Joined: 01 Oct 2003
Posts: 172
Location: Punta Gorda, Florida USA

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

Question about using constants isnside delay_func()
PostPosted: Wed Mar 10, 2004 4:52 pm     Reply with quote

Question
I have been trying getting around the fact that built in timing functions like delay_us, delay_(ms) or delay_cycles can only use an 8 bit unsigned variable or a constant up to 32768. I need to be able to adjust a timing sequence at runtime to a value that is larger than a byte and cannot use conditional statements such as IF or SWITCH because of their execution timing latency. One thing I thought I could do is generate various #defines and then plug them in before I execute my routines.
The basis of my question; is if you can use a constant inside these timing routines why wont the following work???

#define LongTime 23465
delay_cycles(LongTime);
It should work?? isn't the number 23465 placed in place of LongTime?
but the compiler gives me an error:
"Expression Must be a constant or simple variable"

Any help or guidance would be appreciated
cbarberis



Joined: 01 Oct 2003
Posts: 172
Location: Punta Gorda, Florida USA

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

Never Mind,, I just answered my own silly question
PostPosted: Wed Mar 10, 2004 5:00 pm     Reply with quote

The fact is that delay_cycle() only uses a numerical constant or variable from 0 to 255 unlike the other functions, where if you use the #define it works OK

Should read the manual before using. Confused
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