A cordial Greeting to all, I am new in this of the microcontroller programming, and I have a problem with the programming of the oscillator, my program is the following one:
void InitOsc(void)
{
WDTCTL = WDTPW | WDTHOLD; // Paramos el watchdog timer
BCSCTL1 |= XTS; // XT1 ~ high-frequency
_BIC_SR(OSCOFF); // turn on XT1 oscillator
do // wait in loop until crystal is stable
{
IFG1 &= ~OFIFG;
for (ii = 0xFFFF; ii > 0; ii--);
}
while (IFG1 & OFIFG);
BCSCTL1 |= DIVA1 | DIVA0; // ACLK = XT1 / 8 = 1 MHz
IE1 &= ~WDTIE; // desactiva WDT int.
WDTCTL = WDTPW | WDTTMSEL | WDTCNTCL | WDTSSEL | WDTIS1; // use WDT as timer, flag each. 512 pulses from ACLK
IFG1 &= ~WDTIFG; // clear WDT int. flag
while ((IFG1 & WDTIFG)!=0); // cuenta 1024 pulsos XT1
IFG1 &= ~OFIFG; // clear osc. fault int. flag
DCOCTL |= DCO2 | DCO1 | DCO0;
BCSCTL1 |= RSEL2 | RSEL1 | RSEL0; // MCLK = DCO, 8 MHz (MCLK=Reloj de la CPU)
}
What happens is that when arriving second “while”, it is begun, we go non sle of the and not you because, my intention is that XT1 oscillates at 8MHz, ACLK = XT1 / 8 = 1 MHz and MCLK=8MHz.
Another problem is that not you that capacities have to put in XIN and XOUT, because alone I use an oscillator, this is due to that not you, you not to find the name of the glass or the “Laud-Capicaty” of the crystal that corresponds XT1.
Once already knowing this you that the capacities XIN and XOUT should be:
C = 2* (Cload-Cpin)
C: each Capicator at XIN and XOUT
Cload: Load-Capicaty demanded by the crystal (found in crystal datasheet)
Cpin: parasitic capacity at the pins of the MSP430 (appr. 2 pF)
Good thank you for their attention and to have if somebody can help me with some of my problems. :roll:[/b]