EmbeddedRelated.com
Forums
Memfault Beyond the Launch

Re: how to refer to cycles counter in a program??.

Started by Paul Curtis May 2, 2003
> I have a question. If there comes a situation in which i have to 
> refer to the Cycles Counter of the
microcontroller, how would i do 
> that..??. Is it #CYCLES. ( i have seen in one of macro application 
> program). But, the C compiler gives error on it. Is it the case that 
> #CYCLES is allowed in the mcros, but are not allowed in C 
> Compiler.?.. Looking for reply,

The MSP430 does not have a cycle counter register.

-- Paul.

Beginning Microcontrollers with the MSP430

HI! Paul,
thanx for reply. There may not be any hardware register in the msp430 
as cycles counter. But, the compiler keeps track of it. THis is why, 
while debugging, IAR C-SPY shows Cycles counter contents in the 
register window. Also, as we specify interrupts according to cycles. 
So, compiler must trace number of cycles that msp430 is executing. My 
question is can we use that information..??. consider a situation (in 
simulation), while polling an input bit, i have to update the input 
register in a macro if the current cycle counter has passed some 
value. How can i do that..??.
One more question..How can we declare arrays in a macro..??. I have 
declared an array in a C fashion, but the debugger has declared it as 
an error.
__var array_value [15];
(in IAR version 2.10A)
...regards.
Khubaib

--- In msp430@msp4..., "Paul Curtis" <plc@r...> wrote:
> > I have a question. If there comes a situation
in which i have to 
> > refer to the Cycles Counter of the microcontroller, how would i 
do 
> > that..??. Is it #CYCLES. ( i have seen in one
of macro 
application 
> > program). But, the C compiler gives error on
it. Is it the case 
that 
> > #CYCLES is allowed in the mcros, but are not
allowed in C 
> > Compiler.?.. Looking for reply,
> 
> The MSP430 does not have a cycle counter register.
> 
> -- Paul.


At 06:11 AM 5/3/2003 +0000, Khubaib wrote:
>HI! Paul,
>thanx for reply. There may not be any hardware register in the msp430
>as cycles counter. But, the compiler keeps track of it. THis is why,
>while debugging, IAR C-SPY shows Cycles counter contents in the
>register window. Also, as we specify interrupts according to cycles.

I am afraid you are missing several things up. First of all, I have never 
used C-SPY :-) but if you are talking about the simulator, then it is very 
easy to tell you the cycle counts at any moment in time because the 
simulator would obviously know about it. It has nothing to do with the 
compiler!

// richard <http://www.imagecraft.com> 
<http://www.dragonsgate.net/mailman/listinfo> 



Memfault Beyond the Launch