This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430g2553 delay issues

Other Parts Discussed in Thread: MSP430G2553

Hi All,
I am using MSP430G2553 in one of my projects.
Please help me in resolving below queries.
1.When we put delay of 5 Microsec in program then actually  it will give us 58 Microsec delay while operation.How is it possible?
2.What is max.clock frequency of MSP430G2553 microcontroller ?How can I achieved it?
Please give us solution for same.
  • How do you generate the delay?

    The MSP430G2553 can ce clocked at a maximum of 16MHz.

    To set the DCO to 16MHz, just write:

    BCSCTL1 = CALBC1_16MHZ; // Set range to 16MHz
    DCOCTL  = CALDCO_16MHZ; // Set DCO step and modulation to 16MHz

    Unfortunately this device can't be clocked by a high frequency crystal - only a watch crystal with 32k768Hz is suitable here. Or an external clock source up to 50kHz or something like that.

  • Thanks for your quick reply Dennis
  •   if (CALBC1_1MHZ==0xFF)		// If calibration constant erased
      {											
        while(1);                               // do not load, trap CPU!!	
      } 
      DCOCTL = 0;                               // Select lowest DCOx and MODx settings
      BCSCTL1 = CALBC1_16MHZ;                    // Set range
      DCOCTL = CALDCO_16MHZ;

    I think you should clear the DCOCTL register first before loading the Calibration constants.

    or else it won't give you the expected accurate frequency.

  • Thanks for your quick reply
  • If you put a 5µs delay in your code, then you'll get a 5µs delay. So apparently you did put something in your code which you think could give you a 5µs delay but gives you an 58µs delay. Which can be because of several reasons. Since you didn't post your code, it is completely unknown what the reason could be.

    However, the CPU doesn't know about (micro) seconds. It only knows about clock cycles. Everything is based on clock cycles. If the clock signal that sources the CPU, timers, whatever, is slow, you will 'see' a long delay, if it is fast, you'll see a short delay, with exactly the same code.
    So the questions are: what method did you use to create a delay (timer, delay loop), could other code interfere (e.g. an ISR that executes during a delay loop will extend the delay) and what are your system clock settings on which all this is based.

    Time is relative, clock cycles are absolute.

**Attention** This is a public forum