[Newbie Question][Proficy Machine Edition] If Statement

другие контроллеры
Post Reply
Yoooj
Posts: 2
Joined: Wed Mar 05, 2014 10:36 pm

[Newbie Question][Proficy Machine Edition] If Statement

Post by Yoooj » Wed Mar 05, 2014 10:45 pm

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. :)

Linkinx64
Posts: 894
Joined: Sun Apr 11, 2010 3:00 am
Location: Russia

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

Post by Linkinx64 » Thu Mar 06, 2014 5:44 am

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

Yoooj
Posts: 2
Joined: Wed Mar 05, 2014 10:36 pm

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

Post by Yoooj » Thu Mar 06, 2014 7:18 am

Forgot to mention. I have to use ladders :(. Any example would be appreciated.

Linkinx64
Posts: 894
Joined: Sun Apr 11, 2010 3:00 am
Location: Russia

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

Post by Linkinx64 » Thu Mar 06, 2014 11:49 am

Example with falling edge detector (temp: F_TRIG)
Image

Post Reply