Discussion in "Project Addition or Changes" started by    kooroshi60    Aug 29, 2013.
Thu Aug 29 2013, 04:19 am
#1
Hello everyone. I have built a PIC based VA meter but its code has two minor problems I have explained below:
1: At the second line of main code:
define MAX_IN_SCURT 5
(SCURT in Romanian means short)
5 is the maximum seconds that output power is allowed to stay shorted. This is too much. Even .1 second is too much because the power transistors (2n3055 in my case) will burn in a blink if their output gets shorted.
Is it possible to change the code in order to make it open the relay immediately as the short circuit happens?

AND THE SECOND:
This line (of ds18b20.h) defines the temperature at which cooler goers on.
if(((temp_whole/10)%10) >= 5) PORTD.F1=1; // Aici setez temp de pornire cooler [5=50 grade]
Since the temperature rises slowly, it plays at the margin of 49-50 degrees and in result, fans starts and stops many times until it reaches and stays on 50 degrees. I need to add a feature in a way that it keeps the cooler on for 20 second every time temperature reaches 50. Just like a laptop cooler behaves when senses the defined temperature. It can prevent the cooler from repeating start and stops.

I’m a beginner in programming so I need your help on this.
Thank you.

Attachment
Thu Aug 29 2013, 06:49 pm
#2
Its pretty easy to do these changes. ok lets take it one by one.

for short circuit your code uses timer0 for 1 sec delay and timer tick is configured for 0.005926s and loop runs for 169 times to generate 1 s delay. the variable timer flag (timer0_flag) gets incremented every 5.926ms depending on how much time you want the trigger to happen.. change following part of code
if(timer0_flag >
= 169) {
              sec_scurt++;
              timer0_flag = 0;
}

e.g. if you want 50ms as trigger then change 169 to 10 and MAX_IN_SCURT to 1. so relay will be triggered 50ms after short is detected.

For second... The actual temperature controllers work in following way... the define a band gap, e.g. 5* band. so if your trigger point is 50* then you will turn fan on when your temp reaches 48. once it reaches 48 you turn fan on and then do not turn in off till it reaches 52* and as soon as it reaches 52 you turn off fan. thats how you maintain mean temperature at 50*

hope you get it... so change your loop accordingly.

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

RodneyKnorb
Thu Apr 25 2024, 07:08 pm
Williamjef
Thu Apr 25 2024, 02:08 pm
SamuelSmise
Thu Apr 25 2024, 09:56 am
DustinErele
Thu Apr 25 2024, 08:44 am
ztaletpzca
Wed Apr 24 2024, 11:19 pm
IrardlPex
Wed Apr 24 2024, 08:42 pm
Charlestehed
Wed Apr 24 2024, 05:20 pm
Robertgurse
Wed Apr 24 2024, 02:43 pm