View previous topic :: View next topic |
Author |
Message |
hobby_85
Joined: 17 Aug 2009 Posts: 50
|
condition always true. |
Posted: Sat Oct 17, 2009 3:31 am |
|
|
Hey, if i have a for loop, and I need to put in a delay,
so like for(counter=0; counter < X ; counter ++){ do whatever}
why does the maximum value for X have to be 65535? And apart from changing the clock setup, so that each count was longer, is there a way past this?
thanks |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Sat Oct 17, 2009 5:47 am |
|
|
If you need a delay, why not using the CCS built-in delay_XX() functions? They are achieving exact delays, considering the clock settings.
Quote: | why does the maximum value for X have to be 65535? |
It doesn't. The range depends on the variable type of counter and is different for unsigned/signed int8/int16/int32. |
|
|
hobby_85
Joined: 17 Aug 2009 Posts: 50
|
|
Posted: Sat Oct 17, 2009 7:04 am |
|
|
FvM wrote: | If you need a delay, why not using the CCS built-in delay_XX() functions? They are achieving exact delays, considering the clock settings.
Quote: | why does the maximum value for X have to be 65535? |
It doesn't. The range depends on the variable type of counter and is different for unsigned/signed int8/int16/int32. |
cool. thank you! |
|
|
|