wake up from sleep


Closed Thread
Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Well, if you're not going to use the WDT, and you can spare RB6 and RB7, you could use a
    32,768kHz crystal with Timer1.

    Code:
    @ DEVICE PIC16F628A,WDT_OFF,LVP_OFF,MCLR_OFF,INTRC_OSC,BOD_OFF
    
    DEFINE OSC 4
    SYMBOL LED = PORTB.0
    
    LED = 1           ' At POR, LED off after 1st toggle
    TRISB.0 = 0       ' LED pin an output
    TMR1H = $60       ' Pre-load TMR1 with $6001
    TMR1L = $01
    PIR1.0 = 0        ' Clear TMR1 overflow interrupt flag bit
    PIE1.0 = 1        ' TMR1 overflow interrupt enabled
    INTCON.6 = 1      ' Enable TMR1 peripheral interrupt
    T1CON = %00111111 ' External 32,768kHz crystal w\caps used, 1:8 prescale, TMR1 on
    
    Main:
       TOGGLE LED     ' Indicates wake-up timing
       @ SLEEP        ' Goto sleep (for ~9.999 seconds)
       T1CON.0 = 0    ' Stop TMR1 on overflow wake-up
       TMR1H = $60    ' Re-load TMR1 with $6001
       TMR1L = $01
       PIR1.0 = 0     ' Clear TMR1 over-flow int flag
       T1CON.0 = 1    ' Re-start TMR1
       GOTO Main
       
       END
    That would wake-up after sleep at roughly 10 second intervals without a button press. Do
    whatever you need for the .1 sec, then go back to sleep.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  2. #2
    Join Date
    Jun 2006
    Location
    Greece
    Posts
    302


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bruce View Post
    Well, if you're not going to use the WDT, and you can spare RB6 and RB7, you could use a
    32,768kHz crystal with Timer1.

    Code:
    @ DEVICE PIC16F628A,WDT_OFF,LVP_OFF,MCLR_OFF,INTRC_OSC,BOD_OFF
    
    DEFINE OSC 4
    SYMBOL LED = PORTB.0
    
    LED = 1           ' At POR, LED off after 1st toggle
    TRISB.0 = 0       ' LED pin an output
    TMR1H = $60       ' Pre-load TMR1 with $6001
    TMR1L = $01
    PIR1.0 = 0        ' Clear TMR1 overflow interrupt flag bit
    PIE1.0 = 1        ' TMR1 overflow interrupt enabled
    INTCON.6 = 1      ' Enable TMR1 peripheral interrupt
    T1CON = %00111111 ' External 32,768kHz crystal w\caps used, 1:8 prescale, TMR1 on
    
    Main:
       TOGGLE LED     ' Indicates wake-up timing
       @ SLEEP        ' Goto sleep (for ~9.999 seconds)
       T1CON.0 = 0    ' Stop TMR1 on overflow wake-up
       TMR1H = $60    ' Re-load TMR1 with $6001
       TMR1L = $01
       PIR1.0 = 0     ' Clear TMR1 over-flow int flag
       T1CON.0 = 1    ' Re-start TMR1
       GOTO Main
       
       END
    That would wake-up after sleep at roughly 10 second intervals without a button press. Do
    whatever you need for the .1 sec, then go back to sleep.
    Thank you . I will try.

Similar Threads

  1. 16F181: can't wake up from sleep
    By Navaidstech in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 9th January 2010, 04:33
  2. Won't go back to SLEEP after 1st Interrupt
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 32
    Last Post: - 29th June 2009, 09:00
  3. 16F628A current high during sleep
    By Rubicon in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 9th October 2006, 10:21
  4. Wierd sleep issue
    By orca in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 14th March 2006, 22:06
  5. 18F2320 and sleep function
    By Brian in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 10th March 2005, 13:11

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts