12c508 @sleep command?


Closed Thread
Results 1 to 8 of 8
  1. #1
    rtsandiego's Avatar
    rtsandiego Guest

    Default 12c508 @sleep command?

    I was wondering if it is possible to use the assembly command "@sleep" to have a 12c508a chip stop execution and then start again where it left off after sensing an input level change.

    I am worried that it will reset execution at the start of the program.

  2. #2
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    It'll work just fine, but WDT must be OFF otherwise it'll reboot the PIC.

  3. #3
    rtsandiego's Avatar
    rtsandiego Guest


    Did you find this post helpful? Yes | No

    Cool sleepy eyes

    Thanks for the tip on WDT. I'll give it a try today.

    It's amazing what can be accomplished by using PIC's.

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


    Did you find this post helpful? Yes | No

    Default 12C508A & SLEEP

    The 12C508A series can only wake-up from SLEEP with a device reset like /MCLR, WDT timeout, or wake-up on pin change.

    The catch is - that even wake-up on pin change with the 12C508A causes a device reset, and you're starting over again from square #1 after any wake-up event.

    The good news is - the 12C67x series can wake up from SLEEP & then continue execution at the instruction immediately after the SLEEP instruction if you have global interrupts disabled (GIE=0).

    With global interrupts enabled (GIE=1), the 12C67x will wake-up, then execute the instruction after the SLEEP instruction, then branch to the interrupt vector at location 0004h assuming you have an interrupt handler in place.
    Regards,

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

  5. #5
    rtsandiego's Avatar
    rtsandiego Guest


    Did you find this post helpful? Yes | No

    Default 12c508 vs. 12c67x

    So on the '508 series it always reboots regardless of the enable WDT settings?

    Bummer. The '508 series are typically the most inexpensive PIC's.

  6. #6
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    > Bummer.

    Not quite... all you have to do at the start of your program is check the GPWUF bit in the STATUS register

    eg...

    If STATUS.7=1 then goto WakeFromSleep

    See Datasheet section 8.7 and section 4.3. I keep saying to everyone, you gotta read those Datasheets - or if like me, reading Datasheets isn't your thing on cold winter nights, then at least get to know where things are found so you can jump straight to it - all Microchips Datasheets follow the same layout.

    PS. If you want to play with little PIC's then 12F675 is the way to go... they're almost the price of the 12C508/9 and still dropping.

    Melanie

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


    Did you find this post helpful? Yes | No

    Default

    Yep - you're still in charge if you know where to look...;o]

    I agree with Melanie. If you want the best bang-for-the-buck, then go with the 12F675 or 12F629. They have a few more features, are re-programmable, and only a few pennies more than the 508 series.
    Regards,

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

  8. #8
    rtsandiego's Avatar
    rtsandiego Guest


    Did you find this post helpful? Yes | No

    Thumbs up Goin' with a new uP

    Took a look at the 12F629. Goodbye '508, Hello Flash memory!

    Thanks Melanie and Bruce for your good advice.

Similar Threads

  1. My code for TV remote and MIBAM for RGB control
    By idtat in forum Code Examples
    Replies: 4
    Last Post: - 12th January 2013, 20:52
  2. Easy HID Command -Response application
    By ptig185 in forum USB
    Replies: 25
    Last Post: - 22nd September 2010, 19:56
  3. Active low input?
    By CosMecc in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 8th August 2010, 20:31
  4. Can I do this???
    By noobie in forum mel PIC BASIC
    Replies: 2
    Last Post: - 10th June 2006, 18:57
  5. Interupts and Command string
    By Tissy in forum Serial
    Replies: 13
    Last Post: - 17th March 2006, 23:59

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