![]() ![]() ![]() ![]() ![]() ![]() |
||
![]() |
||
![]() ![]() ![]() ![]() This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc. |
||
![]() |
![]() |
#46 |
Member
|
Not sure what you mean, there is only one shift register, so can only have one divert, if a box has a "6" in it then it can only go down one cross lane (Lane6).
|
![]() |
![]() |
#47 |
Lifetime Supporting Member
|
|
![]() |
![]() |
#48 |
Member
|
We all get that, in my case it's old age lol,
![]() |
![]() |
![]() |
#49 |
Member
![]() ![]() Join Date: Feb 2015
Location: Ontario
Posts: 720
|
I don't have TIA14 loaded on my laptop so I put it on TIA13SP2, man was that primitive compared to 16.
I imported a tested code but I couldn't test the simulation blocks on TIA13 because PLCSIM crapped out for some reason. So instead of just checking for duplicates I decide to test for count values that are too close based on a settable value. The justification for that is that depending on how fast things are moving and encoder resolution I may a get two values that are too for the scan time. LINK |
![]() |
![]() |
#50 | |
Member
![]() ![]() Join Date: Feb 2015
Location: Ontario
Posts: 720
|
Oops
Quote:
|
|
![]() |
![]() |
#51 |
Member
|
I had some time on my hands, just done some experiments (Mitsubishi Q series), used the block move for 500 registers just made the destination +1 from the source, no other program and the scan time was 0.6ms, Tried with shift register, & the scan time went up to 2.4ms. Then tried a for next loop & same result 2.4ms, so as for scan time it only makes just less than 2ms above the scan time of the block move, in reality this is not going to cause a major difference unless the pulses are less than the scan time. but block move in this case was certainly the fastest, I tried adding the block move to a reasonable sized program & the scan time only increased by 0.4ms.
Not been able to try this on any other platform so cannot verify what functions will increase the scan time more, It appears on Mitsubishi the block move compiled code is the most efficient, however, it appears that the shift function must be producing similar code to the for next loop which is in ladder. |
![]() |
![]() |
#52 | |
Member
![]() ![]() Join Date: Dec 2020
Location: Mid Ulster
Posts: 36
|
Quote:
|
|
![]() |
![]() |
#53 |
Member
|
No I wrote it before he did, but never posted it, and I never bothered to save the code,
Here is a homemade shift register using pointers SET(Trigger,Pulse); (*Set the bit to run the logic *) IF Pulse THEN Index:= 63; FOR Loop_Count:= 0TO 63 DO; Last_Index:= Index-1; (* need to point to the array - 1 as well as the array pointer *) My_Array[Index ] := My_Array[Last_Index]; Index:= Index -1; (*Decrement the index pointer *) END_FOR; Pulse:= FALSE; (* Reset the trigger & pulse flags *) Trigger := FALSE; END_IF; Also, Here is a quickie I did in FBD that shows a simple (only two diverts shown). |
![]() |
![]() |
#54 |
Member
|
Here is another way of doing it using block copy, only thing is you have to zero the first word in the array or every shift would put the same number in.
By copying the block from word zero to word one shifts the data by one all down the line, not sure if this works on all platforms as will depend on how it copies it but in theory it does it in reverse order you would need to try it on S7. |
![]() |
![]() |
#55 | |
Lifetime Supporting Member
|
Quote:
It looks like @parky is shifting integer valuess through the position in an integer shift register, which values may be a code for a lane number. Each code will trigger a divert when it is in only one constant position (index) of the shift register. My implementation was based on bits; bits in integers to be sure, but bits nonetheless. Because my non-shifting register is static and the code is incrementing ("moving") the index, my code
|
|
![]() |
![]() |
#56 |
Member
|
DR: not bits words so the operator enters the lane number on the HMI (for convenience I have put 7 buttons so each button will put 1-7 in the array at position 0, when the shift is triggered this shifts the data down the array If you think about the conveyor just being a load of words in the array i.e. one foot of the conveyor = one location in the array so if the diverts were spaced every 20 feet then divert 1 = array[20]. divert 2 = array[40] & so on. so by comparing say array[20] with 1 if true then run divert code & the same goes for the other 6 diverts.
I have done a number of ways to create a "WORD" shift register, i.e. Use in-built (but I don't think S7 1200 has one), the other is to use a loop in ST. SET(Trigger,Pulse); (*Set the bit to run the logic *) IF Pulse THEN Index:= 63; FOR Loop_Count:= 0TO 63 DO; Last_Index:= Index-1; (* need to point to the array - 1 as well as the array pointer *) My_Array[Index ] := My_Array[Last_Index]; Index:= Index -1; (*Decrement the index pointer *) END_FOR; Pulse:= FALSE; (* Reset the trigger & pulse flags *) Trigger := FALSE; END_IF; ; The other is to use MOVE_BLK this could copy say 500 words of array to the same array but shifted by one location i.e. MOVE_BLK IN = Source address (Array[0]) IN = Count (500_ OUT = Dest (Array[1]) So many ways to achieve the same thing |
![]() |
![]() |
Bookmarks |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Siemens or Omron? | Gromit | LIVE PLC Questions And Answers | 35 | November 14th, 2017 10:44 AM |
Siemens S7 300 Shift Register | Dean1278 | LIVE PLC Questions And Answers | 12 | September 20th, 2011 04:39 PM |
help with shift register | saleshark | LIVE PLC Questions And Answers | 4 | December 8th, 2009 07:50 AM |
FTSR-IN & OUT (Fall Through Shift Register) | ilikbeer | LIVE PLC Questions And Answers | 5 | January 19th, 2005 03:14 PM |
Shift register | Divad016 | LIVE PLC Questions And Answers | 6 | November 11th, 2003 08:52 PM |