Countdown Timer Dual toggle Relays- Working Project

For MIAC users to discuss projects, applications, and any other issues related to the MIAC unit.

Moderators: Benj, Mods

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

Countdown Timer Dual toggle Relays- Working Project

Post by medelec35 »

I thought I would share this project.
It was developed in my spare time for the company I work for. Now they have to buy a Miac, because they are not having mine! :p

This application does the following:
Turns relay 1 on for a set period of time (relay 1 on time), increment number of cycles, counts down to zero, turns relay 1 off, then relay 2 on, counts down for a set period of time (relay 2 on time), then cycle is repeated, adding 1 to the number of cycles.
Setting up both times (relay 1 on time and relay 2 on time) is very easy. Hours and Minutes and seconds can be set up or down by using the cursor keys. If timer is running and pause is pressed, then I have designed the timer to stop, but the relay to stay on. That way adjustments to equipment under test can be carried out.
No need to keep setting up timers if Miac disconnected from power source. Hours minutes and seconds of both timers and number of cycles are stored in EEPROM, so will be retrieved when power is reconnected.
Since number of cycles are stored in EEPROM, If you want to start with 0 cycles, then hold OK button and at the same time press reset switch,

Only Got Miac 3 days ago, and I work full time, so at this stage programming won't be the most complex of master pieces around. But saying that, it still works very well and does the job it was intended to do.
Countdown.jpg
(154.31 KiB) Downloaded 2886 times


My next step is to add a temperature sensor to shut relays down, in event of unit under test overheating ......Watch this space!
Attachments
countdown.fcf
(53.39 KiB) Downloaded 615 times
Last edited by medelec35 on Tue Apr 20, 2010 2:26 pm, edited 1 time in total.
Martin

F22-Raptor
Posts: 13
Joined: Fri Nov 20, 2009 2:58 pm
Contact:

Re: Countdown Timer Dual toggle Relays- Working Project

Post by F22-Raptor »

Looks cool.

Thanks for posting it.

I need a countdown timer so maybe you're code will help me figure out how to do that.

D.

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

Re: Countdown Timer Dual toggle Relays- Working Project

Post by medelec35 »

Thanks.
Its a bit complex for a countdown timer because is a dual timer which activate two relays, and is using same icons for both displays.
If you need any help simplifying for just 1 countdown timer just ask. That's what we are here for.
Martin

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

Re: Countdown Timer Dual toggle Relays- Working Project

Post by medelec35 »

Bug fixes:
Fixed a bug which set both times to the same time when altering time in pause mode.
If reset cycles counter, now 0 is displayed and not 1 .
Also If reset cycle counter, EEPROM is updated with Cycles = 0. So if power is removed and applied, then cycles = 0 and not the previous value before reset cycles counter.
Minor improvements:
When times are adjusted, the original times are displayed for adjustment, not current time after a count down period, as in the previous version.

Note: Even if not using this to drive electrical items, you could still use this for a dual countdown timer.
Also the simulation is working 100%
If you want to reset simulation cycle counter: With simulation stopped, Press F8 key once, hold down number 4(either number pad or number above E and R keys). click Run whist still holding 4 down. Cycle counter should be reset. Release 4

Only difference between simulation and real hardware, When running simulation and you have started countdown timer running, You will need to wait for a about 33 seconds for countdown to start (since that's how long it takes for Timer0 INT to work). On real hardware count down is virtually instant!
Attachments
countdown3.fcf
(53.86 KiB) Downloaded 592 times
Martin

Post Reply