Examples/library for powersaving/sleep/watchdog

General discussion on mikroBasic for dsPIC30/33 and PIC24.
Post Reply
Author
Message
peterverkaik
Posts: 174
Joined: 31 Aug 2009 22:44

Examples/library for powersaving/sleep/watchdog

#1 Post by peterverkaik » 18 Nov 2009 21:35

Hi,

Are there libraries or code examples how to use
powersaving or sleep for some time?

regards peter

User avatar
mileta.miletic
mikroElektronika team
Posts: 493
Joined: 05 Jun 2009 14:46
Location: Belgrade, Serbia
Contact:

Re: Examples/library for powersaving/sleep/watchdog

#2 Post by mileta.miletic » 08 Dec 2009 16:54

Unfortunately there are no libraries for powersaving or sleep mode. Here is little watchdog example for dsPIC30F4013, maybe it will help:

Code: Select all

program WatchDog_Timer

main:

  ADPCFG = 0xFFFF   ' Configure AN pins as digital
  
  asm
    CLRWDT           ' asm line, clear WatchDog Timer
  end asm
  
  PORTB = 0x00FF    ' Initialize PORTB
  TRISB = 0         ' Configure PORTB as output
  Delay_ms(300)     ' Wait 0.3 seconds
  PORTB = 0xFF00    ' Change PORTB value
  
  while (TRUE)      ' endless loop, WatchDog_Timer will reset PIC
    nop
  wend
    
end.
Regards,
Mileta

Post Reply

Return to “mikroBasic for dsPIC30/33 and PIC24 General”