Sign in

username:

password:



Not a member?

Search msp430



Search tips

Subscribe to msp430



Ads

Discussion Groups

Discussion Groups | MSP430 | Re: Changing clock source

The purpose of this group is to foster exchange of information on the Texas Instruments MSP430 family of microcontrollers and related tools. Everyone welcome, all levels of familiarity/expertise.

Re: Changing clock source - old_cow_yellow - Jul 6 5:45:05 2008

You have: "BCSCTL3 |= LFXT1S_0;".

I can't figure out what effect it has.

--- In m...@yahoogroups.com, "stanci10" wrote:
>
> Hi!
>
> I can't figure out what is wrong with my piece of code: basically, I
> took SimpliciTI code and I wanted to change clock from VLO to 32KHz
> crystal. I thought that all I need to do is to change one line of
> code; instead of:
>
> //BCSCTL3 |= LFXT1S_2;
> put
> //BCSCTL3 |= LFXT1S_0;
>
> ... but after that my timer didn't work. So, to make it simpler, I
> wrote small program where, if I change LFXT1S_0 to LFXT1S_2, the
> program works (it uses VLO) but when I change clock to LFXT1S_2 I
> still don't have that TimerA pops up. This program is shown below.
> I'm using ez430-rf2500 TI mote.
>
> I looked into the examples I found on TI website, but I still really
> need help to figure out why is this not working!
> Could you please help me?
>
> Thank you!
> #include "msp430x22x4.h"
> #include "bsp_leds.h"
> #include "bsp_buttons.h"
>
> void MCU_Init(void);
> void toggleLED(uint8_t which);
> void doSomething(void);
> int trigger;
>
> void main (void)
> {
>
> WDTCTL = WDTPW + WDTHOLD; // Stop WDT
> {
>
> volatile int i;
> for(i = 0; i < 0xFFFF; i++){}
> }
>
> BSP_Init();
>
> MCU_Init();
>
> doSomething();
>
> }
>
> void doSomething()
> {
>
> while(1)
> {
>
> if (trigger)
> {
> toggleLED(1);
> toggleLED(2);
> trigger = 0;
> }
> }
> }
/*------------------------------------------------------------------------------
> *
>
------------------------------------------------------------------------------*/
> void MCU_Init()
> {
>
> //BCSCTL1 &= ~(XTS);
> BCSCTL3 |= LFXT1S_0;
>
> TACCR0 = 10000;
> TACTL = TASSEL_1 + MC_1; // ACLK, upmode
> TACCTL0 = CCIE; // TACCR0 interrupt enabled
>
> __enable_interrupt();
> }
>
/*------------------------------------------------------------------------------
> * Toggle LEDs
>
------------------------------------------------------------------------------*/
> void toggleLED(uint8_t which)
> {
> if (1 == which)
> {
> BSP_TOGGLE_LED1();
> }
> else if (2 == which)
> {
> BSP_TOGGLE_LED2();
> }
> return;
> }
/*------------------------------------------------------------------------------
> * Timer A0 interrupt service routine
>
------------------------------------------------------------------------------*/
> #pragma vector=TIMERA0_VECTOR
> __interrupt void Timer_A (void)
> {
> trigger = 1;
>
> }
>

------------------------------------



(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )