Hi @ all!
I'm confused about the examples for TimerB. I want to create a dynamic
signal started from a Port 1 Interrupt.
After 30% of time I want to generate a high-impulse and when timer is
reaching the maximum the high-impulse should end.

I think that should work with:

TBCCR0=1000;
TBCCR1=333;
But in the example this values doesn't work. Sometimes the Interrupt-Vector
"TIMERB1_VECTOR" is used and in the other examples The Interrupt-Vector
"TIMERB0_VECTOR" is used. Where is the difference an why allways my debugger
shows that "TBIV" is 14 - overflow?
Is the overflow simmilar to the TBCCR0-Value?


#include  <signal.h>
#include  <io.h>

int main(void)
{ 
  WDTCTL = WDTPW + WDTHOLD;             // Stop WDT
  FLL_CTL0 |= XCAP14PF;                 // Configure load caps
  TBCTL = TBSSEL1 + TBCLR + TBIE;       // SMCLK, clr. TBR, interrupt
  P5DIR |= 0x02;                        // Set P5.1 to output direction
  TBCTL |= MC1;                         // Start Timer_B in continous
  _EINT();                              // Enable interrupts
 
  for (;;)                              
  {
    _BIS_SR(CPUOFF);                    // CPU off
    _NOP();                             // Required only for C-spy
  }
  return 0;
}

// Timer_B7 Interrupt Vector (TBIV) handler
interrupt (TIMERB1_VECTOR) Timer_B(void)
{
  switch( TBIV )
  {
   case  2: break;                      // CCR1 not used
   case  4: break;                      // CCR2 not used
   case 14: P5OUT ^= 0x02;              // overflow
            break;
  }
}

Greetings
Ben

-- 
NEU +++ DSL Komplett von GMX +++ http://www.gmx.net/de/go/dsl
GMX DSL-Netzanschluss + Tarif zum supergünstigen Komplett-Preis!


Reply via email to