ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Black Box with a View, Part 2
Subject:   timing
Date:   2006-03-01 03:55:38
From:   bartvan deenen
Response to: timing

Found my timing problem. There is a bug in timera.h, where ID_DIV8 is (3<<6) and it should be (3<<4). So i set the wrong bits. My time measurement wasn't very accurate, the 1236Hz should have been 800 Hz.


I'm also using the bit of code from page 4-12 of the user guide. My code is now:


<code>
void LED_Timer_Init(int* ignore, struct _LED* const ledp) {

if (_ledp) {
return;
}


_ledp = ledp;


_BIC_SR(OSCOFF); // turn on oscillator
BCSCTL1 |= XTS; // high frequency
do {
IFG1 &= ~OFIFG;
volatile unsigned char i;
for(i=0;i<255;i++);
} while ( IFG1 & OFIFG );
BCSCTL2 |= SELM1 | SELM0 | BIT3;
BCSCTL1 &= ~(BIT4 | BIT5);
BCSCTL1 |= BIT5 | BIT4;
TACCR0 = 0;
TACTL = TASSEL_ACLK | MC_UPTO_CCR0;


TACCTL0 = CCIE;
}


</code>


1 to 1 of 1
  1. timing
    2006-03-01 10:39:07  georgebelotsky [View]

    • timing
      2006-03-01 11:58:52  bartvan deenen [View]

      • timing
        2006-03-01 12:00:52  bartvan deenen [View]

        • timing
          2006-03-01 18:11:06  georgebelotsky [View]

1 to 1 of 1