EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

TimerA problem!!!!

Started by ramesh babu nalagarla March 10, 2004
Hello all,I'am using MSP430F412 micro controller for my
project.I'am operating the micro in Low power mode 3(LPM3).My application
should update the display for every one second.I configured TimerA for one
second interrupt and in Up mode.
My display is 8 digit display and uses 3-Mux pattern for writing into
segments,When I'am writng into display I'am loosing some time.i.e
I'am not getting interrupt for every one second.I'am loosing the time
say for example for 1000 seconds my display is showing 990.If I commented the
display function I'am getting accurate count.Can any body give me soltution
for this.
Thanks & Reards,
Ramesh
 


---------------------------------
Do you Yahoo!?
Yahoo! Search - Find what youre looking for faster.




Beginning Microcontrollers with the MSP430

ramesh babu nalagarla wrote:

> Hello all,I'am using MSP430F412 micro
controller for my project.I'am
> operating the micro in Low power mode 3(LPM3).My application should
> update the display for every one second.I configured TimerA for one
> second interrupt and in Up mode. 
...
 > I'am loosing the time say for example for 1000
> seconds my display is showing 990.

do you use one of the timer capture/compare modules in compare mode? (i 
guess so) then make sure that you set up the next interrupt by 
calcluating the next time with CCRx and not TAR because TAR can change 
if you're servicing the CCRx interrupt a bit late or do much processing 
before doing the CCRx update.

e.g.

TACTL = TACTL_INIT;
CCTL0 = CCIE;
CCR0  = TA_ONE_SECOND;	//timer units for one second
TACTL |= MC1;	        //start timer

then in the CCR0 interrupt handler. (mspgcc style):

interrupt (TIMERA0_VECTOR) ccr0_interrupt(void) {
   CCR0 += TA_ONE_SECOND;
   seconds++;
//...
}


Hi,

we got a similar problem, using timer A as a timing source (1 
millisecond) for a control algorithm, disrupted by the UART-interrupt.
Check the priorities of the interrupts you use! Switching to the timer 
B instead of timer A for the timing source (higher priority of timer 
B-interrupt versa UART-interrupts), solved our problem.

Regards, Timo

--- In msp430@msp4..., ramesh babu nalagarla 
<ramesh_sri2000@y...> wrote:
> Hello all,I'am using MSP430F412 micro
controller for my project.I'am 
operating the micro in Low power mode 3(LPM3).My application should 
update the display for every one second.I configured TimerA for one 
second interrupt and in Up mode.
> My display is 8 digit display and uses 3-Mux
pattern for writing 
into segments,When I'am writng into display I'am loosing some
time.i.e 
I'am not getting interrupt for every one second.I'am loosing the time 
say for example for 1000 seconds my display is showing 990.If I 
commented the display function I'am getting accurate count.Can any 
body give me soltution for this.
> Thanks & Reards,
> Ramesh
>  
> 
> 
> ---------------------------------
> Do you Yahoo!?
> Yahoo! Search - Find what you're looking for faster.
> 
> 


Hi Chris!Thanks for the reply.I tried in the way you suggested.I.e. in the
isr making 
CCR0+=TMRA_SEC_CNT.But the problem is still persisteing.My TMRA_SEC_CNT is
32767.Any other solution please.....
Regards,
Ramesh

Chris Liechti <cliechti@clie...> wrote:
ramesh babu nalagarla wrote:

> Hello all,I'am using MSP430F412 micro
controller for my project.I'am
> operating the micro in Low power mode 3(LPM3).My application should
> update the display for every one second.I configured TimerA for one
> second interrupt and in Up mode. 
...
> I'am loosing the time say for example for
1000
> seconds my display is showing 990.

do you use one of the timer capture/compare modules in compare mode? (i 
guess so) then make sure that you set up the next interrupt by 
calcluating the next time with CCRx and not TAR because TAR can change 
if you're servicing the CCRx interrupt a bit late or do much processing 
before doing the CCRx update.

e.g.

TACTL = TACTL_INIT;
CCTL0 = CCIE;
CCR0  = TA_ONE_SECOND;      //timer units for one second
TACTL |= MC1;              //start timer

then in the CCR0 interrupt handler. (mspgcc style):

interrupt (TIMERA0_VECTOR) ccr0_interrupt(void) {
   CCR0 += TA_ONE_SECOND;
   seconds++;
//...
}



.





Click Here

---------------------------------
. 



---------------------------------
Do you Yahoo!?
Yahoo! Search - Find what youre looking for faster.





The 2024 Embedded Online Conference