This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Systemclockupdate

I need to generate PWM signal in cortex-M3. With timer example program i changed some part of the code. While compiling i was having one warning as systemclockupdate. While building the target is not created. Please help me.

Thank You.

Parents Reply Children
  • Per,
    Dnt be sarcastic. But the comment was funny.(sic)

    Divya,
    The prescale value or the match register value is not proper. But that are only my guesses.
    Post the code. we cant solve anything without looking at the code.

  • Oki sir. I ,ll check it out. Anyway i ll show my code.

    void TIMER0_IRQHandler (void)
    { if ( LPC_TIM0->IR & (0x1<<0) )
    { LPC_TIM0->IR = 0x1<<0;
    timer0_m0_counter++;
    if ( ( LPC_TIM0->TCR == TIME_INTERVALmS * 15) )
    { reset_timer( 0 );
    enable_timer (0);
    LPC_TIM0->MR0 = TIME_INTERVALmS * 1;
    LPC_GPIO0->FIOSET|=(1<<21);
    LPC_GPIO1->FIOSET = 1<<29;
    } if (LPC_TIM0->TC == TIME_INTERVALmS * 1 )
    { reset_timer( 0 );
    enable_timer (0);
    LPC_GPIO0->FIOCLR|=(1<<21);
    LPC_GPIO1->FIOCLR = 1<<29;
    LPC_TIM0->MR0 = TIME_INTERVALmS * 15;
    } }
    if ( LPC_TIM0->IR & (0x1<<1) )
    { LPC_TIM0->IR = 0x1<<1;
    timer0_m1_counter++;
    } if ( LPC_TIM0->IR & (0x1<<4) )
    { LPC_TIM0->IR = 0x1<<4;
    timer0_capture0++;
    } if ( LPC_TIM0->IR & (0x1<<5) )
    { LPC_TIM0->IR = 0x1<<5;
    timer0_capture1++;
    } return;
    }

    uint32_t init_timer ( uint8_t timer_num, uint32_t TimerInterval )
    { uint32_t pclkdiv, pclk;
    if ( timer_num == 0 )
    { timer0_m0_counter = 0;
    timer0_m1_counter = 0;
    timer0_capture0 = 0;
    timer0_capture1 = 0;
    LPC_SC->PCONP |= (0x01<<1);
    #if TIMER_MATCH
    LPC_PINCON->PINSEL3 &= ~((0x3<<24)|(0x3<<26));
    LPC_PINCON->PINSEL3 |= ((0x3<<24)|(0x3<<26));
    #else
    LPC_PINCON->PINSEL3 &= ~((0x3<<20)|(0x3<<22));
    LPC_PINCON->PINSEL3 |= ((0x3<<20)|(0x3<<22));
    #endif
    LPC_TIM0->IR = 0x0F;
    pclkdiv = (LPC_SC->PCLKSEL0 >> 2) & 0x03;
    switch ( pclkdiv )
    { case 0x00:
    default:
    pclk = SystemFrequency/4;
    break;
    case 0x01:
    pclk = SystemFrequency;
    break;
    case 0x02:
    pclk = SystemFrequency/2;
    break;
    case 0x03:
    pclk = SystemFrequency/8;
    break;
    } LPC_TIM0->PR = pclk/1000000; /* set prescaler to get 1 M counts/sec */
    LPC_TIM0->MR0 = TIME_INTERVALmS * 15; /* Set up 15 mS interval */
    #if TIMER_MATCH
    LPC_TIM0->EMR &= ~(0xFF<<4);
    LPC_TIM0->EMR |= ((0x3<<4)|(0x3<<6));
    #else
    /* Capture 0 and 1 on rising edge, interrupt enable. */
    LPC_TIM0->CCR = (0x1<<0)|(0x1<<2)|(0x1<<3)|(0x1<<5);
    #endif
    LPC_TIM0->MCR = (0x3<<0); //|(0x3<<3); /* Interrupt and Reset on MR0 and MR1 */
    NVIC_EnableIRQ(TIMER0_IRQn);
    return (TRUE);
    }

    Please help me where i done mistake...

    Thank You.