Re:How to implement 20 mins on of relay with timer and how to implent start/pause with the same timings

Go To Last Post
12 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,I am using ATMEGA88PA i need to configure timer for 20 mins (Relay will be on for 20 mins time)kindly guide me how to implement,for example in this 20 mins timing if i press start/pause button after 5mins the timer should stop untill next time start/pause button pressed once press detects remaining 15 mins of time(relay has to be on) Kindly guide me .

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Check for button being pressed.  When button pressed set relay on and wait 20mins ignoring button state.  When 20 mins up set relay off and return to beginning.

 

Or you might want to do something more sophisticated.

 

David 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi David 

 

Thank you for your reply,

 

 

 

Can you please  elaborate how to do with timer  setting 20 mins count in timer ,How to implement timer for 20 mins  kindly guide me.

 

 

Thanks &Regards

Samathasan

Last Edited: Sun. Apr 5, 2015 - 12:55 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How many of us has this poster PM'd?

Last Edited: Sun. Apr 5, 2015 - 01:08 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Fortunately I have not been blessed.

 

I presume that certain schools advise their students to "get their homework done by visiting Avrfreaks".

The more enterprising ones have learned to PM several members with the identical question.

 

It prepares them for life in a "Call Centre" making unsolicited phone calls.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It prepares them for life in a "Call Centre" making unsolicited phone calls.

NICE!!

 

TO the OP

 

IT's rather rude to be 'cold calling' members via PM.  Please stop doing it.

 

As to your assignment, set up a timer to cause an interrupt every ten milliseconds,

Iin the Interrupt service routine have the timer increment a counter.

In the MAIN as DAflippers look for the start button.  When it's pressed turn the timer ON(hint: CLOCK)

Turn on the port pin associated with the relay

Also have your MAIN look at the counter and after x amount of milliseconds increment another counter(hint:SECONDS)

Now have your MAIN look at the second counter and if 20 minutes worth of seconds have elapsed, turn off the port pin associated with the relay

Once the 'seconds' counter has hit it's limit, reset it.

if during all of this, the start/pause button is pressed stop the timer(hint: CLOCK)

 

That's the basics, I left out a few small, but key points that you, and the datasheet should be able to figure out.  If not, then post your code that you have written, and advice will be given.

 

Cheers!

Jim

 

 

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I posted a very high description in the hope the OP would do some searching.  I even contemplated suggesting to get such a long delay the simplest solution would be to clock the uController from the mains as is only 50/60 Hz but I thought better of it ;o)

 

David 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

simplest solution would be to clock the uController from the mains as is only 50/60 Hz but I thought better of it ;o)

I would hesitate the OP would be able to safely know how to clock a micro off the mains.  JMO

 

Let's see what happens with what I left on the plate

 

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I would hesitate the OP would be able to safely know how to clock a micro off the mains

I know....English sense of humour.

 

David 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman sorry i was not knowing PM 's are serious.i never do it thank you .sorry for that

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

sorry i was not knowing PM 's are serious.

PM's are not 'serious', but if you are sending out PM's en mass, that is considered spamming.  Don't worry about it,  I should have explained myself a little better. :)

 

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank You Jim