Not sleeping well

Go To Last Post
7 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I want my mega88 to stop, halt, go no more, quit, not resume (unless you cycle power)

cli  ;kill all interrupts
sts pcmsk2, zero  ;turn off PCINT18
sts PCICR, zero ;kill the pin interrupts
ldi temp, 0b00000101 ;powerdown mode
sts smcr, temp
sleep

I'd think shutting off the interrupts, and setting the shutdown would put it to sleep....but it just keeps chugging along. ...am I overlooking something? I am using PC18 and uart RX interrupts.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
I want my mega88 to stop, halt, go no more, quit, not resume (unless you cycle power)

Hit the little sucker with a ball peen hammer. That'll fix it. Except for that cycle power nonsense, of course.

Chuck Baird

"I wish I were dumber so I could be more certain about my opinions. It looks fun." -- Scott Adams

http://www.cbaird.org

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Take 2 aspirin and call me in the morning.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

...am I overlooking something?

Silly question but if you disable interrupts exactly how were you hoping for it to be woken out of sleep (assuming you managed to get there)?

BTW why are you using STS to access SMCR. On a mega88 it's at IO address 0x33 (RAM address 0x0053) so I bet the opcode you wrote actually says:

sts 0x0033, temp

Try:

out smcr, temp

(this is yet another reason why you should use Atmel's LOAD/STORE macros!!)

[lucky for you RAM 0x0033 (IO 0x13) is a "reserved" register so you weren't damaging anything important by writing to the wrong register]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You could try programming in C and use the asm code produced by the compiler.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
Silly question but if you disable interrupts exactly how were you hoping for it to be woken out of sleep (assuming you managed to get there)?

Answer contained in first post - he wants it to REALLY go to sleep... until a power cycle resets the chip.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Note--I want to sleep and NOT ever wake up.

Thanks --it was indeed a simple sts vs out command error....good idea to use the macros.

I owe you 100 billion clock cycles

Now I'm sleeping fine zzzz.....

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!