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

Wake up from power-down only once

Hello all,

I am working on a project using Winbond W77E58. To save energy, if there is no trigger input from P3.2 (INT0/), P3.3 (INT1/) or P3.0 (Serial Port) for some time the MCU will go into power-down mode. In my design, the MCU is woken by the external interrupt 3 (INT3/).

For the first time of power-down, the MCU can be woken by triggering the INT3/. But after some time when the MCU goes into power-down mode again, the MCU does not respond even though same input is from INT3/. It seems the MCU sleeps forever after the first awake.

unsigned char counter1=0x00;
unsigned char counter2=0x00;

void main(void)
{
unsigned short timer=0x0000;
while(1)
{
timer++;
if(timer=0x0F00)
{
PCON |= 0x02;//Power Down Mode
_nop()_;
timer=0x0000;
}//if
}//while
}//main

void interrupt_int0 (void) interrupt 0 using 1
{
counter1++;
}

void interrupt_int1 (void) interrupt 2 using 1
{
counter2++;
}

void interrupt_int3 (void) interrupt 8
{
}

Does anyone know how to solve this problem?

Please help.

Jones

Parents
  • Although you've used the correct 'pre' and '/pre' tags, you still seem to have lost your indentation!

    Be sure to use spaces only - not TABs - to lay-out your code!

    Like this:

    unsigned char counter1=0x00;
    unsigned char counter2=0x00;
    
    void main(void)
    {
       unsigned short timer=0x0000;
       while(1)
       {
         timer++;
          if(timer=0x0F00)
          {
             PCON |= 0x02;//Power Down Mode
             _nop()_;
             timer=0x0000;
          }//if
       }//while
    }//main
    

    Did you mean:

    if( timer == 0x0F00 ) // Equality. Not assignment?
    

Reply
  • Although you've used the correct 'pre' and '/pre' tags, you still seem to have lost your indentation!

    Be sure to use spaces only - not TABs - to lay-out your code!

    Like this:

    unsigned char counter1=0x00;
    unsigned char counter2=0x00;
    
    void main(void)
    {
       unsigned short timer=0x0000;
       while(1)
       {
         timer++;
          if(timer=0x0F00)
          {
             PCON |= 0x02;//Power Down Mode
             _nop()_;
             timer=0x0000;
          }//if
       }//while
    }//main
    

    Did you mean:

    if( timer == 0x0F00 ) // Equality. Not assignment?
    

Children