| Sign In/My Account | View Cart |
| Article: |
Black Box with a View, Part 2 | |
| Subject: | timing | |
| Date: | 2006-03-01 02:54:00 | |
| From: | bartvan deenen | |
|
Hi George
|
||
Showing messages 1 through 5 of 5.
Actually, timera.h looks correct.
3 << 6 = 0xC0
= 0x80 + 0x40
... which is bits 7 and 6 set
</pre>
From page 11-20 of the
IDx bits (which control input clock divider) are 7 and 6 -- if both are set, the clock is divided by 8. Also, several of TI's code examples -- such as fet140_ta_09.c -- illustrates the use of the ACLK with an HF crystal.
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>