Need to pick your brains, S7 palletiser program

Johnny T

Member
Join Date
Jul 2003
Location
Fife, Scotland
Posts
642
I'm writing a program (or attempting to) for a palletiser. It is running on an S7-313C PLC.

I'm basically after picking your brains on the best way to go about doing it and also a few specific questions I have. I'll give you the overview of the problem.

This palletiser runs a number of different pallet 'patterns'. They are comprised usually of two differently patterned layers in order to build the pallet with a 'brick' effect and make it more stable.

The palletiser has to be able to turn certain packs, count the packs in, push a full row across. Do this until all the rows for that layer are pushed across and then push the entire layer on top of the pallet and start building a new layer. When the required number of layers is reached, it ejects the pallet.

Sounds simple on the face of it but its been wrecking my head all day !

I want to write the code to make it very easy to add new pallet patterns in the future. So I came up with this...

DB100 holds the following:
CANS_ON_ROW_SO_FAR
CANS_NEEDED_IN_THIS_ROW
ROWS_COMPLETED_SO_FAR
ROWS_REQUIRED_ON_LAYER
LAYERS_COMPLETED_SO_FAR
LAYERS_REQUIRED_FOR_FULL_PALLET

Then I have DB1 which is going to hold one full pallet patterns data as:
word 0 = ROW_1_CANS_NEEDED
word 2 = ROW_2_CANS_NEEDED
etc etc.. this continues for 32 rows and over 2 layers (there will never be more than 32 rows, although there may be less)

Also in DB1 I have:
ROW_PATTERN_TURN_1 ... through to ROW_PATTERN_TURN_32

This is a double word that describes the orientation of the packs as they go into the machine. 1 = normal orientation. 0 = turned pack. (I should point out that I'm hoping to use these words in their 'bit' form in order to achieve this).

So, you can see that the idea was to be able to make a Data Block up that would basically store a 'code' that would make a pallet up. I could change the code and create any pallet format I needed.

The operation of the code was to call the first Data Block and transfer the ROW_1_CANS_NEEDED to DB100 (which would be used by the main program). I would then compare the number of products into the machine with the ROW_1_CANS_NEEDED. When they matched I would execute the code that pushes the row and then transfer ROW_2_CANS_NEEDED into DB100 etc etc

This would work the same with the number of rows and the number of layers.

My problems are two-fold...

Firstly, is this the best way to go about this in your opinion or do you know of a better way?

Also, how do I indirectly transfer a Data Block Word. If I wanted to move DB1.DBW0 to DB100.DBW2 but then next cycle move DB1.DBW2 to DB100.DBW2 etc etc how do I do the indirect addressing. I've played around with P#DB1.DBW0 etc but can't get anything to work. Does anyone know the correct format for these...

Sorry the post is so long winded, I'm tying myself in knots over here trying to get my head around this machine !

Any help would be greatly appreciated.

Cheers

JT :)
 
Last edited:
JT

I don't have Seimens experience, but I have developed "patterns" for palletizers before. Do you have a pattern already loaded in the PLC? We had several loaded in our palletizer so for my first pattern from scratch, I copied one of the originals and tailored it to what I needed on the new pattern. We called up the different patterns from an HMI.
 
Rube, unfortunately I don't have anything except a blank canvass. The old PLC was a 5TI Sequencer and we had no way of interrogating it. There was a really old listing but it has massive gaps in it to the point where I thought it was probably easier to start from scratch rather than try and untangle it.

The main problem is how to do indirect addressing and also whether there is a better way of writing the code in principal.

I thought that instead of 'hard wiring' the patterns into the code, if I could make the code flexible and just accept a 'code' that translated into a pattern format, it would make it much more robust in the future and far easier to maintain.

The big problem is that it sounds great on paper, but it is a little harder when it comes to writing the thing!!

As Penelope Pitstop would say..HeeeeLLLLP !!

:)
 
Johnny,

There has been a lot of discussion about S7 indirect addressing during the past year, so do a search and you'll find plenty to get you started. I have posted several sample code archives, as have others. Take a look, and get back to us.

As for the approach that you need to use, without knowing more about the machine, I would think arrays would be useful here. I remember posting some code for a guy who was sorting boards for a beam production plant, so maybe that would give you some ideas.
 
Too bad it's not a Von Gal with an AB in it or I could really be of some help. Appears Jay has had some Von Gal experience over there in Dallas.
 
I've been on to Siemens and they've sent me a PDF about indirect addressing which I'm now reading through.

I've posted the file here in case anyone else is struggling.

:)
 
I was told to come back if I was still struggling... well, I am, so here I am !

I'm reading the example of indirect addressing in S7 which says:

L MW 54
SLD 3
T MD 50
L IB 1
T QB[MD 50]

OK, but I can't get this to do what I want.

I'm after transferring DB1.DBW6 to DB100.DBW2.
Then, after some things have happened, I want to transfer DB1.DBW 16 to DB100.DBW2.
Then, after some more things.. I want to transfer DB1.DBW 26 to DB100.DBW2

I've tried..
L 6
T MW 50
L DBW[MW 50] // I've already OPN'ed the DB1 earlier in the code...
etc etc but it won't accept this..

Anyone any ideas ?
 
I've only been to one Siemens class but, the indirect adressing pointer is always at the bit level even if no bit moving is being down. So the example you stated picked up a pointer to somewhere and shifted it left 3 to allow room for the 3 bits whcih can point to one of 8 bits in a byte. If you are moving on the word level or higher these remain at zero. Maybe that will help.
 
Sorry, I can't be of help on the S7 indirect addressing. The Model 5TI just struck a nerve ending remembering the Meridian and Von Gall palletizers that used it.

The 5TI PLC(sequencer) was used by many palletizer vendors during the early 1980's. It's instruction set can be counted on the fingers of both hands, but did some really sophisticated control in its day. The most common method of pattern control was done using a very interesting method of shift register combined with scan tricks (even if the 5TI couldn't even spell SFT.) The patterns were also controlled by JMPs and MCRs (predecessor to indirect addressing, more like indexed addressing.) I also remember decoding thumbwheels the old way in combinational logic.

I cut my teeth on 5TI logic and have not regretted it for the rest of my career. Many of the basic concepts of making bit level programming do more than bang-bang logic were founded in my psyche by this early workhorse. Any body still have the 5TI-2000 programming manual - little black book with the calculator on the front? I have wished for that book several times when converting customer's 5TI programs to modern PLCs.
 
Jay, the original code is full of MCR's and JMP's. I did transpose it into S7 but it is too incomplete to work with. So I decided to write it from scratch.

Bernie, you are right. It says in the example pdf that it shifts the word 3 bits to the right to make it indirectly address a word and not just the bit.

But, what I need is how to indirectly address DB1.DBW XX

What would be the way of writing this?

:(
 
Johnny,

There are several ways to do it, but we'll start out the easy way.

You can't type something like "DB1.DBD[MW50]" or "DB1.DBD[ar1,p#10.0]"in S7. Instead, you would have to do something like:



OPN DB1
L DBD[ar1,p#10.0]

or

L DBD[MW50]

(Of course, you have to make sure that either AR1 or MW50 contain correct pointers.

And as far as pointers go, just think of them as pointing to bits, not bytes. So, if you want to point to data byte 86, then the pointer must have a value of 86bytes*8bits/byte= 688. That is basically what the SLD3 instruction is doing.
 
S7Guy, a big thanks for that. I've followed one of your examples and I'll know tomorrow what happens. I'm off to site first thing to start the next few days of sat in a panel writing the software.

Those days where you sit tearing out your hair and looking at the operators feeling jealous of their job.

If I have any more problems I'll post 'em up. A big thank you in the meantime to everyone who's contributed.

Cheers

JT :)
 

Similar Topics

Good evening. I display the step number of a SFC on a display. Sometimes, on a trip, it goes quickly through many steps and I need to prove to...
Replies
1
Views
100
Good morning all. I'm working on a rehab where they had a standalone InTouch 2014 HMI that they called a SCADA, but it's really basic stuff. The...
Replies
4
Views
166
We are trying to poll data coming from a PLC for remote monitoring we have the IP address of the PLC and the default port number and the path is...
Replies
25
Views
543
The idea here is to provide for a brief rapid influx of message codes while preventing sequentially repeating the same message. i.e. if two...
Replies
23
Views
661
Hi all Trying to remotely connect to a TIA Portal PLC. I can ping it without a problem but can't get my software to connect. I've opened port...
Replies
8
Views
310
Back
Top Bottom