Page 1 of 1

[Newbie Question][Proficy Machine Edition] If Statement

Posted: Wed Mar 05, 2014 10:45 pm
by Yoooj
Hey there!

I've got a "simple" problem, so:

(This is just an example i know it has no sense):

http://imgur.com/WogIgo1

I have to SET Variable to 1 after i press on START and then i have to RESET it to 0 when i press START again and so on to make some Function get to work. I tho it would be easy but i am stuck :(. I have no idea how to SET/RESET it after i press START. Any advices?

Thanks. :)

Re: [Newbie Question][Proficy Machine Edition] If Statement

Posted: Thu Mar 06, 2014 5:44 am
by Linkinx64
Is it principally to use ladder? Try this way:

Code: Select all

IF Start THEN
	IF NOT flag THEN
		Out := NOT Out;
	END_IF;
	flag := TRUE;
ELSE
	flag := FALSE;
END_IF;
where

Code: Select all

FUNCTION_BLOCK start_example
VAR_INPUT
	Start: BOOL;
END_VAR
VAR_OUTPUT
	Out: BOOL;
END_VAR
VAR
	flag: BOOL; (* aux.var *)
END_VAR

Re: [Newbie Question][Proficy Machine Edition] If Statement

Posted: Thu Mar 06, 2014 7:18 am
by Yoooj
Forgot to mention. I have to use ladders :(. Any example would be appreciated.

Re: [Newbie Question][Proficy Machine Edition] If Statement

Posted: Thu Mar 06, 2014 11:49 am
by Linkinx64
Example with falling edge detector (temp: F_TRIG)
Image