Skip to main content
Visitor II
September 8, 2008
Question

Configuring WDG

  • September 8, 2008
  • 4 replies
  • 1195 views
Posted on September 08, 2008 at 16:33

Configuring WDG

    This topic has been closed for replies.

    4 replies

    thiruAuthor
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 09:55

    With the below piece of code, i am able to generate an interrupt at every

    0.35sec (350msec).

    1. Can anyone tell how this stuff works?

    2. Also, I want to change a little bit this code and generate an interrupt at my own specified msec?

    Thanks in advance,

    Thanga

    /***********************************************************************/

    #define WDG_ClockSource_Apb 0xFFFB /*The APB clock signal will be used as counting clock.*/

    /* Configure the WDG to generate an EOC interrupt each 0.35s */

    WDG_DeInit();

    WDG_InitStructure.WDG_Preload = 0xFFFF;

    WDG_InitStructure.WDG_Prescaler = 0xFF;

    WDG_InitStructure.WDG_ClockSource=WDG_ClockSource_Apb;

    WDG_Init(&WDG_InitStructure);

    /* Configure the VIC */

    VIC_DeInit(); /* Initialize the VIC*/

    VIC_InitDefaultVectors(); /* Initialize default vector registers*/

    /* Configure the VIC interrupt */

    VIC_Config(WDG_ITLine,VIC_IRQ,0);

    VIC_ITCmd(WDG_ITLine, ENABLE); /* Enable the VIC */

    WDG_ITConfig(ENABLE); /* Enable the WDG interrupt */

    /* Enable the WDG in Timer mode*/

    WDG_TimerModeCmd(ENABLE);

    /***********************************************************************/

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 09:55

    hi

    1st and just as a remark, do not forget to enable clock to WDT or it won´t work.

    2nd, maybe using 91x_scu.c functions, you could get peripheric clock and calc your own time.

    Take a little look over it, it might help.

    good luck

    thiruAuthor
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 09:55

    I have configured the WDG clock, and it's working (interrupt generated) at every 0.35second.

    Currently i need to genarate an interrupt at an user specified rate.

    any ideas will be appriciated.

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 09:55

    hi

    ''from 2, three'' =P

    or you reprogram WDT to the time interval you wont every time you need to program a diferent one;

    or you build a couter routine on the WDT ISR routine, wich generate a different software interrupt, where the counter have the N times WDT, needed to generate that other interrupt;(this interrupt could be from a non used EXTINT for example)