Show Posts
Pages: [1]
1  Forum 2005-2010 (read only) / Troubleshooting / Re:  Prescaler on Watchdog timer interrupt?? on: March 23, 2009, 09:49:06 pm
Thanks so much for the advise! I will probably stick to other interrupts beings that the watchdog is not entended for that reason.

Thx for all the help my friends!!  smiley-grin
2  Forum 2005-2010 (read only) / Troubleshooting / Re:  Prescaler on Watchdog timer interrupt?? on: March 22, 2009, 03:58:34 pm
it's very possible my friend. I'm attaching the documentation of what I read from the ATmega datasheet.. this is the reason i thought that I could use it as an interrupt.

Thx!

10.9.2 WDTCSR – Watchdog Timer Control Register

WDIF WDIE WDP3 WDCE WDE WDP2 WDP1 WDP0 = WDTCSR

• Bit 6 - WDIE: Watchdog Interrupt Enable
When this bit is written to one and the I-bit in the Status Register is set, the Watchdog Interrupt is
enabled. If WDE is cleared in combination with this setting, the Watchdog Timer is in Interrupt
Mode, and the corresponding interrupt is executed if time-out in the Watchdog Timer occurs.

Watchdog Timer Configuration

WDTON(1)        WDE        WDIE           Mode                     Action on Time-out

      1                  0             0              Stopped                        None

      1                  0             1              Interrupt Mode           Interrupt

      1                  1             0              System Reset Mode       Reset

      1                  1             1              Interrupt                    interrupt
                                                        System Reset             then go
                                                        Mode                        to system
                                                                                        reset

      0                  x             x            System Reset Mode         Reset

• Bit 5, 2..0 - WDP3..0: Watchdog Timer Prescaler 3, 2, 1 and 0

The WDP3..0 bits determine the Watchdog Timer prescaling when the Watchdog Timer is running.

Watchdog Timer Prescale Select

WDP3 WDP2 WDP1 WDP0         Number of WDT     Typical Time-out at
                                              Oscillator Cycles     VCC = 5.0V

   0         0      0        0             2K (2048) cycles       16 ms
   0         0      0        1             4K (4096) cycles       32 ms
   0         0      1        0             8K (8192) cycles       64 ms
   0         0      1        1            16K (16384) cycles    0.125 s
   0         1      0        0            32K (32768) cycles    0.25 s
   0         1      0        1            64K (65536) cycles    0.5 s
   0         1      1        0            128K (131072) cycles 1.0 s
   0         1      1        1            256K (262144) cycles 2.0 s
   1         0      0        0            512K (524288) cycles 4.0 s
   1         0      0        1            1024K (1048576) cycles 8.0 s
3  Forum 2005-2010 (read only) / Troubleshooting / Prescaler on Watchdog timer interrupt?? on: March 21, 2009, 06:01:55 pm
 
I'm wondering if someone knows how to change the prescaler on the watchdog timer enabled as an interrupt?

So far I have been successful enabling the WDT as an interrupt but I can't get the Prescaler to work.

I'm trying to make the WDT interrupt every 1 second so I can make a 24 hr clock with it. In the reference manual it says you can prescale it down to 1 second by setting 1<<WDP2 and 1<<WDP1, but it seems as tho it has no prescaler at all.

Here is a portion of my code so far:

void setup()
{
  cli();          // stop interrupts
  WDTCSR  = (1<<WDCE);     // watchdog change enable
  WDTCSR  = (0<<WDP3)|(1<<WDP2) | (1<<WDP1); // set
                   //prescaler to 1 second
  WDTCSR  = (1<<WDIE) | (0<<WDE);   // enable wdt interrupt
  sei();        // start interrupts
 
}

/*WDT interrupt*/

ISR(WDT_vect)
{
}

ANY HELP WOULD BE GREATLY APPRECIATED!!  
4  Forum 2005-2010 (read only) / Troubleshooting / Re: Newbie hwlp with 20x4 LCD on: August 27, 2009, 11:34:54 pm
Hi, does anyone know if the lcd library can be used with a tm402cd lcd display? it's a 2 by 40 character display that I was told has the same driver as the HD44780 lcd. I can power it properly, it goes blank when the program loads (hello world), then it goes back to full bars and no "hello world" displayed. Can someone help me??

Tanx,

marsbar
Pages: [1]