Help with SLEEP and WAKE UP PIC16F648A

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 7.

Moderator: Benj

Post Reply
electron67
Posts: 302
Joined: Sat Jan 12, 2008 2:08 am
Contact:

Help with SLEEP and WAKE UP PIC16F648A

Post by electron67 »

Hello please can someone help me,
I'm trying to make a small circuit that uses 3 AA batteries and I need to send the pic to SLEEP mode, when checking the current consumption in the PIC I realize that the current drops considerably, but I can't get the switch to do the process programmed, the program is frozen from the beginning, I have added a timer interrupt, but I can't get the PIC to enter WAKE UP mode.

Thanks
Enrique
Attachments
SENSORv5a.fcfx
Flowchart
(16.65 KiB) Downloaded 6 times

electron67
Posts: 302
Joined: Sat Jan 12, 2008 2:08 am
Contact:

Re: Help with SLEEP and WAKE UP PIC16F648A

Post by electron67 »

Hello

I have done many different tests, I used the PIC16F1847, I was able to enter the SLEEP mode and later to WAKE UP, but when the PIC wakes up, it just starts the program sequence, it interrupts and starts from the beginning, it does not finish the sequence started; for example, in the published program, 2 outputs are activated for 50 mS, then there is a 12 second delay, another 2 outputs are activated for 50 mS and at the end of that period they turn off.
The problem is that when the sequence begins it does not end.

As I believed, once the PIC was awakened, the program continued until the end of the sequence, until it again entered the block containing SLEEP :?:

I think that maybe the program that I made has something wrong or it requires knowledge of C language and this cannot be solved with block diagrams !!!


Thank you anyway
Enrique

stefan.erni
Posts: 610
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Contact:

Re: Help with SLEEP and WAKE UP PIC16F648A

Post by stefan.erni »

Hi Enrique

Yes, after the PIC sleeps hi wake up on this place.
I suspect your PIC is crashing because of the delay in the interrupt
It's not a good idea to use a delay in an interrupt. Better do you something there like turn on a led for test( turn it off the before you let the PIC sleep) or just remove the delay in the interrupt .


regards
Stefan

electron67
Posts: 302
Joined: Sat Jan 12, 2008 2:08 am
Contact:

Re: Help with SLEEP and WAKE UP PIC16F648A

Post by electron67 »

Hi Stefan,

I appreciate the help, I will eliminating the delay, to see if I can sleep and wake up the PIC correctly without interrupting the correct sequence in the programming.

Thank you very much
Enrique

electron67
Posts: 302
Joined: Sat Jan 12, 2008 2:08 am
Contact:

Re: Help with SLEEP and WAKE UP PIC16F648A

Post by electron67 »

Hi, I still can't handle SLEEP () mode

I'm still trying to work with SLEEP () mode; and if it goes into sleep mode, but I can't wake up, with INT or IOC interrupts; When I add 10 mS to it in the MACRO interrupt it shows me error when compiling

and when I use to WDT :

WDT MX_CLEAR_WATCHDOG;
WDTCONbits.WDTPS = 0b01110; (16 seconds)

but the program is activated and restarted continuously and does not allow the completion of the PIC programming sequence.
Someone who can please see the flow chart and see where I'm wrong.
With interruption the program falls sleep and does not wake up and with WDT it is continuously restarted without the program ending.
In the flow chart I included the 2 options I am dealing with. Under project options, select :
HS,
WDT Enabled
MClr Enabled
and the other options Disabled

Thanks in advance
Enrique
Attachments
SENSORv7.fcfx
FLOWCHART
(12.23 KiB) Downloaded 4 times

Post Reply