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
  • What part of the code did you change??
    The error or warning has a number. Provide the error/warning number.

    Most Cortex-M3 architectures have an on-chip PWM module and dedicated PWM output channels. Why not use the module? It will reduce the burden on the software and hence the CPU. :)

Reply
  • What part of the code did you change??
    The error or warning has a number. Provide the error/warning number.

    Most Cortex-M3 architectures have an on-chip PWM module and dedicated PWM output channels. Why not use the module? It will reduce the burden on the software and hence the CPU. :)

Children
  • I changed the interrupt handling part. Actually the warning is #223-D:function "Systemclockupdate" declared implicitly. Actually if i remove this line no error. I will be thankful if i get full details about systemclockupdate.

    Thank You

  • Do you understand what "implicitly" means?
    Do you have any function named "Systemclockupdate"?
    If you have a function named "Systemclockupdate", then have you declared the function before calling it?

  • I removed systemclockupdate nd i included system init(). Now its working. but am not getting expected result. I need a square wave of ON period of 1ms and OFF period of 15ms, totally 16ms duty cycle. But am getting 16.9ms duty cycle.I duno where it gone wrong..? Can u help me please.

    Thank You.

  • "I need a square wave of ON period of 1ms and OFF period of 15ms, totally 16ms duty cycle. But am getting 16.9ms duty cycle.I duno where it gone wrong..? Can u help me please."

    So must be something wrong with line 123 then.

  • 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.