Alternating outputs

Electronics Computer Programming Q&A
Post Reply
WCE4
Posts: 19
Joined: Wed Sep 17, 2003 1:01 am
Contact:

Alternating outputs

Post by WCE4 »

Need help in writing a program to alternate two outputs I am using a PIC Chip with the PicBasic Pro Compiler. What I am trying to do is control two fans with one temp. sensor. When The temp is high one fan comes on and cools everything down that fan turns off.The next time when the temp goes high I need it to start the 2nd fan when that fan turns off the first fan is called again.
If one fan is running and the temp is still rising the second fan comes on. I am having a hard time on the alternating part
THANKS WCE4
hlreed
Posts: 349
Joined: Wed Jan 09, 2002 1:01 am
Location: Richmond, TX
Contact:

Re: Alternating outputs

Post by hlreed »

You need to algebratize your problem. What you are doing is driving two outputs from one input which leaves one undefined so you need a memory.
Let F1 be fan 1, and F2 be fan 2.
Let T be the temperature sensor.
Let M be memory<p>Begin
Loop
If M = F1 Then M = F2
If M = F2 Then M = F1<p>If T > x then M ; run M which is either F1 or F2
Goto Loop
End
This will alternate fans.
Add more conditions if you want to run either or both at the same time.
Harold L. Reed
Microbes got brains
WCE4
Posts: 19
Joined: Wed Sep 17, 2003 1:01 am
Contact:

Re: Alternating outputs

Post by WCE4 »

<blockquote><font size="1" face="Verdana, Helvetica, sans-serif">quote:</font><hr>Originally posted by WCE4:
[QB][/QB]<hr></blockquote><p> :D THANK YOU "IT WORKS"
Post Reply

Who is online

Users browsing this forum: No registered users and 25 guests