Johnny T
Member
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
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: