AVR PWM program

Started by ritika February 11, 2011
hi....
We are working on a project to control the position of flapper with 4 fans.In this we have to contol the on off time of the fan with AVR microcontroller 8535 using PWM.The fan should be on for 3 mins and after that the second fan should start for 2 mins.

Can you suggest the logic required to write this program along with some example....

Hi,

From what you have written I suggest following

1. Have a 1sec timer interrupt in the program. Here we can count secs

2. Have flag register, indicating fan off or on.

3. You can switch on/off your fan from any port pin; by sending 0 or 1
as per your hardware.

4. Give on command & start counting secs. & also reset flag.

5. In the interrupt routine From this (if ++sec == 60)->min++ count
min.

6. When the min count reaches to 3; make sec & min =0. And set one
flag.

7. In main routine if the flag is set, switch of the fan & reset the
flag.

8. Now start counting switch off time & if it reaches 2min, use flag
again.

9. So if flag is zero count upto 3min & if set count upto 2min.

10. In short toggle the flag, toggle the port pin , do
time counting in interrupt routine as per the flag.

Its rough but workable idea. You can fine tune & apply the logic. Hope
this will help you.

All the best.

Tks

Prashant

From: a... [mailto:a...] On Behalf
Of ritika
Sent: 11 February 2011 16:14
To: a...
Subject: [AVR club] AVR PWM program

hi....
We are working on a project to control the position of flapper with 4
fans.In this we have to contol the on off time of the fan with AVR
microcontroller 8535 using PWM.The fan should be on for 3 mins and after
that the second fan should start for 2 mins.

Can you suggest the logic required to write this program along with some
example....

Internal Virus Database is out of date.
Checked by AVG - www.avg.com
Version: 9.0.819 / Virus Database: 271.1.1/2842 - Release Date: 04/29/10
11:57:00