DELAY for day's

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

electron67
Posts: 323
Joined: Sat Jan 12, 2008 2:08 am
Has thanked: 106 times
Been thanked: 48 times

Re: DELAY for day's

Post by electron67 »

I proof with that

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: DELAY for day's

Post by medelec35 »

Hi electron67,
Since you are using an EEPROM you need to be aware that it can only be guaranteed to work for 1million read/write cycles
So you will need to carefully decide what you want to store in EEPROM

E.g of you would like to store current time elapsed and you update EEPROM every second, then it will only be guaranteed to work for a total of 11.5 days!
So a diffident approach is needed. What I would do is use a large value electrolytic capacitor only across the supply to microcontroller.
Isolate with a diode (use a diode with low peak forward voltage as possible e.g Schottky).
Connected anode of diode to main supply then connect cathode to +5V of microcontroller.
Connect a spare pin to supply side (anode of diode). I'ts best if you use a pin that can be used with interrupt. E.g INT on falling edge or interrupt on change (IOC)
When main supply drops then since microcontroller has still got supply from Cap the pin that's connected to supply will go from high low, and it's this change that's detected so a macro that writes current values to EEPROM is triggered.
When power is restored then values can be retrieved.

If you only need values stored of entered delay then none of the above is necessary.

Martin
Martin

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: DELAY for day's

Post by medelec35 »

Hi electron67,
I have improved Flowchart for you.

If there is a current time or set time (or both stored) on EEPROM then these will be retrieve.

During timing period EEPROM updates every hour as a compromise. But easily changed to update on loss of power (its only a theory will work).
Also time period can be changed by pressing * key.
Press # to stop/pause time and # again to continue timing. There is Run or stop displaying depending if timer is running or not

When setting timer, press # or * for the second digit to re-enter. Mistakes can happen :)
Time elapsed is shown on top line and Set time is shown on the bottom line of LCD

I have put some invalid entries detection.
E.g if enter 98 seconds then you will be made to enter seconds again.
Same with minutes, Hours and Days.

Hope this helps

Martin
Attachments
PRUEBA V2.fcf
Not tested on hardware
(77.85 KiB) Downloaded 270 times
Martin

electron67
Posts: 323
Joined: Sat Jan 12, 2008 2:08 am
Has thanked: 106 times
Been thanked: 48 times

Re: DELAY for day's

Post by electron67 »

Thank a lot, Martin
I test the circuit now (DELAYS3 in program including), work perfect:
1st 30 second good
2o 30 minutes good
3o 1 hour good
4o 8 hour good
5o 1 day good (time exact)

I think the pic is programmed once and then they would be calling minutes, seconds, days or hours depending on what was programmed, such routine light a each hour for 20 seconds only be write in the eeprom one hour and 20 secundos one time in the PIC but every time I run the program that will read in eeprom, but I not know that the eeprom can read/write 1 million cycles (I know now). The program have 150 (variable) write in the eeprom once and when run the program read 150 (variable) every time.
I see the program prueba v2.

Thanks for help me. :D
Electron67

Post Reply