S7 and (N) usage

dwoodlock

Lifetime Supporting Member
Join Date
Nov 2012
Location
Cincy/nKY
Posts
567
Gentlemen and Ladies(maybe?),

So Im working to debugging a program for one of our presses and I have come accross a funny usage of the negative edge detection instruction.

I was always under the impression that the memory bit that you use for your (N) instruction, should'nt be used anywhere else in the program.

In the attached picture you will see that they reference it elsewhere, and this is'nt the only location where this takes place.

Has anyone else come across something like this? This press has a lot of devices communicating and its just been pretty buggy from the get go.

Thanks in advance,

Added a higher quality image

FC33.PNG
 
Last edited:
The first network "does its thing" while the M149.6 is OFF, thus the description is "FP_Can" .
Also, in the first network your M149.6 is used for a "READ"
The second network works only once, during the tranasition of the M149.6 going LOW and the output is marked as "FN_Can".
On the second network your M149.6 is also getting a "WRITE".
2 different things.
Maybe that's where you get confused.
You can "READ" the bit anywhere you want they just "WRITE" to it in one location though.

Think about it as a CAM. they check "Duration" and also "transition" of sorts.
 
Generally speaking, you are correct, you shouldn't use that bit again. Definitely you should never write to it. However, reading it for a specific purpose could be acceptable in the right circumstance, if you know what you are doing.

The bit used for the (N) stores the value of the RLO. Since the only contact before the (N) is I96.3, they are effectively just storing the value of the input in the memory bit.

When they read the memory bit in network 5, they are reading the value of the input from LAST SCAN. The result of the logic is that if the input is true currently, and was false last scan, then FPCan is true. Effectively, they are using one bit to do both positive edge detection.in network 5, and negative edge detection in network 6.

Although this may be memory efficient, saving one bit here and there is probably not enough to be relevant. You can see that it definitely makes the code harder to read. I wouldn't recommend using this programming style as a best practice, but it does work.

Also, as an FYI it only works if the rungs are in a certain order. The network where the edge detection bit is set (P) or (N) must be after all the networks where you are reading the bit as last scan's info. It is very easy to start programming this way, and then accidentally add code later on, without realizing it is out of order and won't work. I did it a few times and screwed up a few times, before I gave in and just started using all the bits I actually needed.
 
My question was more in a general sense, have people come across, or written logic in this fashion and had good luck with it.

The function related to this logic, which is scrap detection inside of an angle window that is programmable by HMI does'nt work worth a flip.

I know how I would have written it, and I'm more or less wanting to see if people find this to be a common practice or see anything wrong with it?

My experience is limited admittedly, but I've never seen the memory bit for a one shot instruction used elsewhere in the program.
 
Generally speaking, you are correct, you shouldn't use that bit again. Definitely you should never write to it. However, reading it for a specific purpose could be acceptable in the right circumstance, if you know what you are doing.

The bit used for the (N) stores the value of the RLO. Since the only contact before the (N) is I96.3, they are effectively just storing the value of the input in the memory bit.

When they read the memory bit in network 5, they are reading the value of the input from LAST SCAN. The result of the logic is that if the input is true currently, and was false last scan, then FPCan is true. Effectively, they are using one bit to do both positive edge detection.in network 5, and negative edge detection in network 6.

Although this may be memory efficient, saving one bit here and there is probably not enough to be relevant. You can see that it definitely makes the code harder to read. I wouldn't recommend using this programming style as a best practice, but it does work.

Also, as an FYI it only works if the rungs are in a certain order. The network where the edge detection bit is set (P) or (N) must be after all the networks where you are reading the bit as last scan's info. It is very easy to start programming this way, and then accidentally add code later on, without realizing it is out of order and won't work. I did it a few times and screwed up a few times, before I gave in and just started using all the bits I actually needed.

Thanks MK, good input
 

Similar Topics

Hello everyone! This is my first time posting, though I have been to this site a few times hunting for some random problem like we all do. I...
Replies
4
Views
173
Hi everyone I am using Winproladder software for programming FATEK FBs PLCs and in programming, we often use Timers for activation of the...
Replies
4
Views
576
Anybody have any experience using a tone generator on analog signal wires? Trying to locate two analog level sensors in an old plc5 panel that...
Replies
7
Views
993
Dear all, I have some query about the use of Timers in Fatek PLC Module by using WinproLadder Software. I am trying to use one timer instance in...
Replies
5
Views
1,248
Hello, I was looking for some advice. Is there functionality within WinCC (V7.5) to report , list or export all tags that have been used within...
Replies
0
Views
416
Back
Top Bottom