Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

TimerB

sanddhi7sanddhi7 Posts: 2Member
Hallo,

I am writing IAR PowerPac RTOS for MSP430 family and I am using MSP430F1611 microcontroller. The C code developer has used both the timers A&B in his code but in my analysis I have found that Timer B register values does not change through out the code. Since I need a Hardware timer tick for interrupts I decided to use the same timerB for hardware tick with same frequency as my friend has used for other ADC conversions. I would like to know how can I make this tick to other values with pout changong the actual register values.

Here is the code for tick and its tick handler:

I would like to know how can I use the TimerB in such a way that the
register value TBCCRO must not change but it should rather make a tick
approximately every 1ms. As the programmer has already used this timerA and
TimerB in his programe and I have found that TimerB is the only option for
me to use as TimerB tick as its register values are not changing through out
the code.


#define OS_FSYS 3000000

void OS_InitHW(void){
WDTCTL = WDTPW + WDTHOLD; /* Stop watchdog timer */
TBCTL = OUTMOD_4 /*Reset Timer_B7, division 1*/
| (1 << 2) /* Clear timer*/
| (1 << 9); /* Use ACLK as timer clock */
TBCCR0 = (OS_FSYS / 375); /* approx 0.125ms */

TBCCTL0 = 0 /* Initilize capture control */
| (1 << 4); /* Enable compare interrupt */
TBCTL |= (1 << 4); /* Start timer in UP-Mode */
OS_COM_Init(); /* Initialize UART */
}

#pragma vector=TIMERB0_VECTOR // Sandhi
static __interrupt void ISR_TimerB(void)
{
OS_EnterInterrupt();
OS_HandleTick();
OS_LeaveInterrupt();
}

To be more clear I want to make Tick every 1ms with out changing
the Registers value in above program? Kindly give me a solution for this.
According to the above code Tick is made for every 0.125ms
(Since OS_FSYS /375=8000 that means 1/8000=0.125ms every tick)

MSP430F1611 slau is also attached for referance.

With regards,
Prashant Kumar Sandhi.


Sign In or Register to comment.