Siemens S7-300 help

Rushome

Member
Join Date
Apr 2016
Location
Edinburgh
Posts
21
Hi, I need a bit of help. I have an S7-300. it is used to detect wether product is too long etc. When I first turn it on it operates fine and an output is operated to open and air valve and blow the product off. But after so long it stops working. We have another machine with iddentical code/sensors etc and it does not do this. The code which detects a product is too long is as follows

AN I124.0 Product length sensor
JC END1

L MD80 Counter (Encoder signal)
L MD90 Product edge
-D
L MD100 Max product length
>D
AN M1.7 Conveyor is running signal

S DBX (AR1.P#8.3)

END1: CLR

When the result of the subtraction is greater than MD100 and I have a 0 in M1.7 to my understanding it should set the DB bit 8.3 (The DB in question is open in the monitor so the DB is fine). It uses the DB word 8 in a comparator to decide wether to reject or not. For a while once it has been rebooted this works exactly as expected and you see a value written into DBW8 but after a while it stops working. You can monitor and see the comparator pick up that the product is too long but it never seems to write to the DB. Can anyone help? A simple reboot cures the problem for a while.
 
Hello

If you want to acces Dbx 8.3 in db then before you start the code where this bit has to be set there should code like: L P#8.3
Lar 1

Or Lar1 P#8.3

Then at the end of the comparison. S Dbx [Ar1,P#0.0] then you acces bit 8.3 from the opend db

Kind regards

Henny
 
If you have two identical machines: one works and the other doesn't then the problem is not with the software, but looking at the software may reveal which sensor is at fault.

You mention that "it stops working". Can you be more specific? what exactly does it do or not do? This information will help people point you in the right direction.

Nick
 
If the machines are identical you could try swapping the CPUs and seeing if the fault moves?

It could also be something to do with your air supply (moisture in the air, pressure loss etc) or the pneumatics or a solenoid failing etc...
 
If I monitor it initially the piece of code above runs right through to the end. Basically if the sensor is covered for too long it sets the DB bit which rejects the product. But after maybe ten minutes despite the sensor still working which you can see on monitor it no longer sets that bit. You can see all the code working but the bit is not set. the sensor definitely works at this point.
 
Are you still resetting the DB bit correctly somewhere. I can see a CLR instruction in your code but nothing to reset the 'set' DB bit.

Also, is the correct DB still open when it faults? You can check DB1 register to see what DB is open. To make sure put an "OPN DBx" before the Set command.

Also it doesn't show what's in AR1? Are you making sure that's equal to zero? (Assuming you want to set the bit 8.3)

*Edit* you basically need to post the whole code for that section as it looks like (potentially) a code issue outside of that section of code?
 
Last edited:
Yeah. The correct DB is open. I can see that on DB1 register. I'll have to check the code again tonight when I'm in work To see if it resets it somewhere but if I monitor it in a VAT table the value for DBW 8 is 0 so none of the bits are set. I don't know if it helps but this bit is set in code in FC4 which is at the end of the scan. The actual comparator that looks at DBW8 is in FC2 which is at the beginning of the next scan. There is asp reset that puts a 0 into DBW8 but it's in OB100 which only runs on the first scan after startup.
 
Strange one!? So it sets the bit correctly several times and reject fine and then suddenly stops after ten mins or so? Is that correct? Does it always stop working after the same amount of times? Does it always stop working after the same number of correct rejects?
 
No. It's a random amount of time. At start up on Sunday night I tried it and all was fine but after when I came in Monday night it had stopped again. There are various types of rejects all which set a bit in dbw8 and then the comparator in another life of Code says if that word is not 0 set the output. You see all the code process but after so long it stops setting the bit in the code above despite the greater than comparator showing it should.
 
Yeah m1.7 has been monitored and is working fine. That is set of the counter above which comes from the encoder does not change for two seconds. Have checked all of that and it seems fine.
 
Interrupts corrupting AR1 - where's that come from?
Each interrupt get's it's own set of accus, ARs, DB registers etc.

There is no code posted showing how AR1 gets loaded (if at all) - please show the whole story.
 

Similar Topics

Hi to all, Our company does not usually use Siemens PLCs, but have a press with one in it. We are trying to change the IP address in our Simatic...
Replies
2
Views
1,066
I have a siemens 317-2 and an old GOT1000 (GT1675M - V) I am trying to get the darn things communication and having no luck. I have followed the...
Replies
12
Views
2,148
Hello all, I am an electrical engineering student working on a senior design project with an industry sponsor. We are automating a burst test...
Replies
26
Views
13,943
Hey I come before you to ask your help about a problem I'm having with a program for S7-300. Any ideas how to change the first bit of a word (or...
Replies
7
Views
2,600
Good People, I am badly stuck here and seeking urgent help. I am using ET200S system having IM151-8 CPU. The programming software I've got is...
Replies
1
Views
2,355
Back
Top Bottom