Putting PIC16F18857 MCU in to sleep mode and coming out from sleep mode

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Locked
megha
Posts: 2
Joined: Tue Nov 24, 2020 8:25 am
Contact:

Putting PIC16F18857 MCU in to sleep mode and coming out from sleep mode

Post by megha »

Hi,

I am using PIC16F18857 MCU and MPLAB code configurator and XC8 compiler..

Creating the project using MPLAB X IDE ...

For Normal operation IOC interrupt is generating after pressing the switch and setting the flag after interrupt trigger and i am checking that flag in timer and once the switch status becomes high means i am setting one more and processing that in to main while loop...

It working fine as i expected...

but i need to use SLEEP() in my code.. to avoid power consumption..

after adding the SLEEP() instruction in while loop.. it is going in to SLEEP mode by checking reduced current ..i am confirming SLEEP mode it is entering ...

after switch press IOC is generating but why it is not waking the device i am not getting..

Again it is going to sleep mode showing same current ..

can anybody please suggest me.. how to wakeup the MCU from sleep mode using IOC interrupt??

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1287
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 384 times
Been thanked: 614 times
Contact:

Re: Putting PIC16F18857 MCU in to sleep mode and coming out from sleep mode

Post by QMESAR »

HI.

I would advise you to ask this at the Microchip forum ,People here work with Flowcode on PIC

megha
Posts: 2
Joined: Tue Nov 24, 2020 8:25 am
Contact:

Re: Putting PIC16F18857 MCU in to sleep mode and coming out from sleep mode

Post by megha »

Hi,
thanks for reply.. actually i was much struggling to post this problem in microchip forum..

if have any idea about my problem means please help me , it will needful for me..

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: Putting PIC16F18857 MCU in to sleep mode and coming out from sleep mode

Post by kersing »

Having issues posting on the microchip forum does not mean you should post messages unrelated to flowcode on this forum.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Putting PIC16F18857 MCU in to sleep mode and coming out from sleep mode

Post by Benj »

Hello,

It's hard to know whithout seeing your code, are you reading the port register on the IOC interrupt and when arming the interrupt? Without doing this the interrupt won't fire.

Locked