Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Just a quick one about the 819

Status
Not open for further replies.

2camjohn

Member
I read something in the datasheet and I realised I may not be understanding the way the PIC wakes from sleep properly.


Accoring to my interpretation of the datasheet if you wake the PIC with INTCON.GIE disabled the program continues from where it was (ie the next instruction after the sleep instruction.
If you wake the PIC from sleep with the INTCON.GIE enabled it runs the interrupt routine.

Is that correct?

Thanks guys, sorry I know I suck at reading datasheets.
John
 
2camjohn said:
If you wake the PIC from sleep with the INTCON.GIE enabled it runs the interrupt routine. Is that correct?

95%. The datasheet said that it first execute the next instruction after "SLEEP" instruction, then branch to interrupt routine.
 
Hello,

As far as I can remeber, the pic fetches the instruction AFTER sleep BEFORE it goes to sleep.

Soooo this means that when the PIC wakes up, it will already have the next instruction in it's registers ready to run, this can sometimes be a pain, so to get round this problem, make the instruction after sleep NOP, this means that when the PIC wakes up it will do nothing, then either run the INT sub (intcon,gie enabled) or your code (intcon,gie disabled).

I hope this helps! :)
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top