Well, your whole approach is wrong.
1) You are using hardware to set a precise timing, but then use
software to make the pins toggle. Either you use the OUTPUT_TOGGLE
mode for hardware-changing pins TB0 and TB1, obtaining a more precise
timing, or you should use only TIMERB0 in UP_MODE and generate both
signals by software using the same interrupt.
2) TIMERB1_VECTOR shares CC1 throught CC6 interrupt flags, which means
that these are nor being cleared by hardware and you need to do it by
software. I suspect your program is stuck on Timer_B1(), because CCIFG
in TBCCTL1 is never cleared, making P1.2 change at constantly (that
also means you are never again entering Low-power mode after the first
P1.2 toggle) I think the only reason you do see P1.1 change correctly
is that CC0 interrupt has priority over CC1-6.
Best Regards,
Michael Kusch
--- In m..., "old_cow_yellow"
wrote:
>
> TIMERB1_VECTOR is shared with many other interrupts. See User's Guide
> on how to handle it.
>
> --- In m..., Claro Louie wrote:
> >
> > Hi guys,
> >
> > May i ask for pointers regarding this?
> >
> > Below is a code that shows setting the TIMER B module to generate
> two different timing intervals from two control registersim setting
> the clock at 8MHZ. The first interrupt service routine TIMER B0
> outputs 1ms toggling rate and the second interrupt service routine
> TIMER B1 outputs 10ms toggling rate. But when i test this code, the
> TIMER B1 does not output 10ms... Im not sure what is really the
> problem, i suspect the problem is in the setting of CCIE bits. Can you
> help me figuring what really is the problem in the code below why it
> does not result in the way i want it? im using MSP430F2274 uCon.
> >
> > im not quite sure if the timerB module can set different timing...
> >
> > thanks a lot,
> >
> > claro
> >
> > #include "msp430x22x4.h"
> > void main(void)
> > {
> > WDTCTL = WDTPW + WDTHOLD; // Stop WDT
> > P1DIR |= 0x03; // P1.0 output
> >
> > BCSCTL1 = CALBC1_8MHZ;
> > DCOCTL = CALDCO_8MHZ;
> > TBCCTL0 = CCIE; // TBCCR0 interrupt
enabled
> > TBCCTL1 = CCIE;
> > TBCCR0 = 4000;
> > TBCCR1 @000;
> > TBCTL = TBSSEL_2 + MC_2 + ID_1; // SMCLK, contmode
> >
> > __bis_SR_register(LPM0_bits + GIE); // Enter LPM0 w/
interrupt
> > }
> > // Timer B0 interrupt service routine showing 1ms toggling
> > #pragma vector=TIMERB0_VECTOR
> > __interrupt void Timer_B (void)
> > {
> > P1OUT ^= 0x01; // Toggle P1.0
> > TBCCR0 += 4000; // Add Offset to TBCCR0
> > }
> > // Timer B1 interrupt service routine shoeing 10ms toggling rate
> > #pragma vector=TIMERB1_VECTOR
> > __interrupt void Timer_B1 (void)
> > {
> > P1OUT ^= 0x02; // Toggle P1.0
> > TBCCR1 += 40000; // Add Offset to TBCCR1
> > }
> >
> >
> >
> > ---------------------------------
> > Looking for last minute shopping deals? Find them fast with Yahoo!
> Search.
> >
> >
>