Set/reset

userxyz

Member
Join Date
May 2002
Location
any
Posts
2,768
Code:
	  A	 #S_Spoelen_In_A
	  BLD   100
	  FP	#Membit_1
	  =	 L	  0.0
	  A	 L	  0.0
	  AN	#Spo_Stat_1
	  AN	#Spoelen_A
	  S	 #Spoelen_A
	  =	 #Spo_Stat_2
	  A	 L	  0.0
	  AN	#Spo_Stat_2
	  A	 #Spoelen_A
	  R	 #Spoelen_A
	  =	 #Spo_Stat_1

convert to LAD possible

Is there an other way also to do this (maybe a standard function from siemens or something?) ?
 
A bit toggle eh?, no standard function AFAIK but you could simplify it a bit...

Code:
	 A	 #S_Spoelen_In_A
	 FP	#Membit_1
	 =	 L	 0.0
 
	 A	 L	 0.0
	 AN	#Spoelen_A
	 S	 #Spoelen_A
	 JC	_001
 
	 A	 L	 0.0
	 A	 #Spoelen_A
	 R	 #Spoelen_A
_001:	 NOP 0

I'd replace the absolute adressed temp bit with a symbolic one though...
 
It looks like it is ladder displayed in STL. the BLD instruction and the use of L bits gives it away.

Try changing the block view from STL to ladder and it should display in ladder.
 
Here's another version:

Code:
	  A	 #S_Spoelen_In_A
	  FP	#Membit_1
	  JCN   skip
	  AN	#Spoelen_A
	  =	 #Spoelen_A
skip: NOP   0
 
My all time favorite is still this one:

A M10.0
FP M10.1
X M10.2
= M10.2

It will display in FBD, but not ladder. It's a shame that Siemens didn't include XOR instructions in their ladder conversions.
 
....and even more elegant S7_guy!

...that's gotta be as compact as you can get a toggle...
 
Hey

A M10.0
FP M10.1
X M10.2
= M10.2

This is great, It's much better then my own code

this one I don't understand, is this a real toggle ? :::


A #S_Spoelen_In_A
FP #Membit_1
JCN skip
AN #Spoelen_A
= #Spoelen_A
skip: NOP 0​
 
If there is no rising edge, JCN skip will execute and #Spoelen_A will not be modified. If there is a rising edge the jump will not execute and then if #Spoelen_A=0 it will become a 1 and if #Spoelen_A=1 it will become a 0 due to:

Code:
AN #Spoelen_A
= #Spoelen_A
 
Hey

Now I understand I think, because AN spoelen wil make the RLO 0 (when spelen is true), = Spoelen wil become zero ...

And when spoelen zero, AN Spoelen makes RLO 1...

?
 
Hey

It's confusing me:

A #Input
FP membit
X #OUT
= #OUT

I tought I understand this code but noooooo... :p

Okay, we got an XOR function in this short code, an XOR on the positive edge from #Input and the #OUT bit.

So we get something like this:

A positive edge
AN #OUT
O
AN positive edge
A #OUT

That´s what I understood of it.

But the XOR is only executed on a positive edge and is only executed for 1 cycle...

So when #OUT is low...
A positive edge
AN #OUT

this in the XOR function wil make #OUT high, and in remains high because there isn´t written to it after that cycle.

When #OUT was 1, then
AN positive edge
A #OUT

so the positive edge wil is one in that cycle, the AN positive edge wil prevent to write 1 to #OUT, so, because #OUT is called in that cycle it will become 0.

Is this correct, or can anyone explain it correctly

Thanks In forward

regards,

Combo
 
I think you understand it ok. I'll put it in my words too:

Ok, assuming all bits are false, we will be waiting for the input to go true. So....

1. #Input goes true. The RLO after the FP Membit is true for one scan.

2. The #Out bit is XORed with the RLO. The conditions are true, so "= #Out" is true.

3. On the next scan, we can assume that #Input is still true (probably a Push Button), but it doesn't matter because the RLO after the FP Membit is now false #Out is true, so the XOR condition is still true.

4. If the button is released, nothing changes.

5. Someone pushes the button again, the RLO after FP Membit is true, and the XOR condition is no longer true. #Out is set to false, and needs another rising edge at the input to set it again.
 
S7Guy said:
I think you understand it ok. I'll put it in my words too:

Ok, assuming all bits are false, we will be waiting for the input to go true. So....

1. #Input goes true. The RLO after the FP Membit is true for one scan.

2. The #Out bit is XORed with the RLO. The conditions are true, so "= #Out" is true.

3. On the next scan, we can assume that #Input is still true (probably a Push Button), but it doesn't matter because the RLO after the FP Membit is now false #Out is true, so the XOR condition is still true.

4. If the button is released, nothing changes.

5. Someone pushes the button again, the RLO after FP Membit is true, and the XOR condition is no longer true. #Out is set to false, and needs another rising edge at the input to set it again.

L D[AR2,P#0.0] said that the XOR allways functions, And I understand why, I was thinking in Lad, XOR after FP does something else in ladder, the XOR would only work one cycle in lad.
And then I understand S7Guy also, it's the RLO of the positive edge that I must XOR with the Output.

XOR is basically a START/STOP circuit

Am I right ?
 

Similar Topics

Hello, I still do not have equipment in to test. But the RTAC ladder does not have a timer reset coil. I wonder if a reset coil on Timer.IN is...
Replies
1
Views
135
Hi, i am using DVP-14SS2 PLC, after program written to plc, when power is reset, plc doesn't run. always need to connect to pc for the run mode.
Replies
0
Views
76
Hi need help why this “failure 5 emergency stop “ appears at every startup in the morning ? Have to shut off main switch at least 10 times on...
Replies
19
Views
416
I was loading a program onto an XE1e2 PLC and it got stuck on these two windows and won't progress. It won't let me connect from the PC to reload...
Replies
0
Views
106
Hi all, i have recieved some 4RF Aprisa SR+ ethernet radios from a customer to configure. Issue is that they are used and have non-default...
Replies
0
Views
112
Back
Top Bottom