SLEEP

For general Flowcode discussion that does not belong in the other sections.
Post Reply
ELECTRONICA67
Posts: 151
http://meble-kuchenne.info.pl
Joined: Wed Dec 02, 2020 3:59 pm
Has thanked: 29 times
Been thanked: 9 times

Flowcode v10 SLEEP

Post by ELECTRONICA67 »

Hello everyone on the forum, I hope you enjoy a Merry Christmas and a Happy New Year 2026 :!:

Continuing with the topic of the SLEEP, WDT, and CLRWDT commands, I'm using a PIC16F1939. It accesses the SLEEP command correctly, although sometimes it doesn't. Previously, I used a PIC16F1847, and SLEEP worked correctly there.

The problem is that the current draw suddenly changes from 0.020 mA to 25 mA after 2 or 3 SLEEP cycles. It starts at 0.020 mA and increases to 25 mA continuously.

This happens repeatedly, I've disconnected transistor outputs, grounded all unused pins, turned off the LCD, and used commands to disable PIC pins, but I can't get the current draw to remain constant while in SLEEP mode.

Initially, I even managed to get the selected outputs to activate correctly when the PIC woke up, and it would return to power-saving mode, but now, with all the changes and tests, it seems like I'm going backward instead of forward.

Could someone help me by taking a look at the flowchart?

I would appreciate any help. :)

Thanks
Enrique
Attachments
ReadRTC.fcfx
(17.49 KiB) Downloaded 16 times
Foto2.jpeg
Foto2.jpeg (137.14 KiB) Viewed 416 times
Foto1.jpeg
Foto1.jpeg (135.92 KiB) Viewed 416 times

BenR
Matrix Staff
Posts: 2053
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 545 times
Been thanked: 729 times

Re: SLEEP

Post by BenR »

Hello,

The errata document for that device does have something regarding Sleep which may or may not help, see page 8 of the doc below.

https://ww1.microchip.com/downloads/aem ... 000501.pdf

chipfryer27
Valued Contributor
Posts: 1800
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 403 times
Been thanked: 619 times

Re: SLEEP

Post by chipfryer27 »

Hi

I have used the 1939 quite a bit, indeed it is a default chip in a couple of my multi-programmers.

I don't recall having much issue with sleep. If I get a chance over the next few days or so I'll load one up and see how it behave during sleep.

Regards

ELECTRONICA67
Posts: 151
Joined: Wed Dec 02, 2020 3:59 pm
Has thanked: 29 times
Been thanked: 9 times

Re: SLEEP

Post by ELECTRONICA67 »

Thanks, I appreciate the help.

Best Regards

chipfryer27
Valued Contributor
Posts: 1800
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 403 times
Been thanked: 619 times

Re: SLEEP

Post by chipfryer27 »

Hi

Realistically it will now be after Christmas before I get a chance to play with hardware. Meantime, following on from Ben's post, it looks like you have BOR disabled so the errata may not apply.

That does however bring up a test you could do to see if you are resetting or Waking Up.

When I'm messing with WDT / sleep etc, until I get everything the way I want I usually have some code at the beginning of Main, before I enter my Main Loop that actually does something. That code could be to flash an LED for three seconds or such like and the point is that it will only flash if the program runs from the beginning. Once I enter my main loop the LED should never flash.

If WDT or something causes a reset rather than wake up then I know something is not correct as the LED will flash.

Regards

ELECTRONICA67
Posts: 151
Joined: Wed Dec 02, 2020 3:59 pm
Has thanked: 29 times
Been thanked: 9 times

Flowcode v10 Re: SLEEP

Post by ELECTRONICA67 »

Hi

Okay, I'll do that test. This way I'll know if it's restarting or continuing where the sequence left off in the programming.

Thanks

Post Reply