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)

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.

Howdy, Stranger!

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