PDA

View Full Version : Turn on output pin



savnik
- 10th March 2007, 17:19
I have two sensors to control one rele.
One for volt and one for temperature.
When the temperature (Vout) exceed the limit (P3) turn on the rele
and if the temperature is below the limit turn of the rele.
I want now , if the volt (value2) exceed the limit (P5) turn on the rele
and stay on for forever, but i don't know how




If Vout >= P3 then 'Temp
PORTA.0=1
Pause 1000
else
PORTA.0=0
endif

If value2 >= P5 then PORTA.0=1 'Volt

P3 and P5 is the limit

HenrikOlsson
- 10th March 2007, 18:18
Hi,
How about this:


Relay var PortA.0 'Relay connected to PortA.0
Latch var bit

ON CON 1 'Constant for relay ON
OFF CON 0 'Constant for realy OFF

Latch = 0

Start:
If Value2 >= P5 then Latch = 1 'Remember that Value2 has exceeded limit

If (Vout >= P3) OR (Latch = 1) then 'Relay ON if Vout is over limit OR Value2 is or have been.
Relay = ON
ELSE
Relay = OFF
EndIf
Pause 1000
Goto Start


Once Value2 is bigger than (or equal to) P5 the relay will turn ON and stay ON forever. Otherwise the state of the relay depends on Vout.

/Henrik Olsson.

savnik
- 10th March 2007, 20:29
Hi,
How about this:


Relay var PortA.0 'Relay connected to PortA.0
Latch var bit

ON CON 1 'Constant for relay ON
OFF CON 0 'Constant for realy OFF

Latch = 0

Start:
If Value2 >= P5 then Latch = 1 'Remember that Value2 has exceeded limit

If (Vout >= P3) OR (Latch = 1) then 'Relay ON if Vout is over limit OR Value2 is or have been.
Relay = ON
ELSE
Relay = OFF
EndIf
Pause 1000
Goto Start


Once Value2 is bigger than (or equal to) P5 the relay will turn ON and stay ON forever. Otherwise the state of the relay depends on Vout.

/Henrik Olsson.
Thank you
If i want to add two more value

If value >= P1 then PORTA.0=1
If value1 >= P2 then PORTA.0=1

how to make this;

Archangel
- 11th March 2007, 02:55
Hi Savnik,
Looks like a job for select case - see page 129 in . . dare I say . .the manual.

savnik
- 11th March 2007, 11:49
Hi Savnik,
Looks like a job for select case - see page 129 in . . dare I say . .the manual.
I read the select case in page 129 , but i cann't understand how to write the code , because i have many variables