Siemens FC92 SHRB Shift Block

Zombo

Member
Join Date
Nov 2003
Location
PA
Posts
50
I want to use a shift register in S7
similiar to the Allen-Bradley BSL/BSR
shift instructions. I found the FC92
bit shift register under standard library
in the TI-S7 converting blocks. Then
I set up a small test program on a
S7-315 PLC however it does not work as
the help file explains it. When I set (1)
a bit using the "DATA" input and enable
the block it sets all the bits indicated
by "N".For example if the "S_BIT" is DB1.DBX0.0 , "DATA"=1 and N=7 it should set bit DB1.DBX0 to one when the "EN" input is set. But the result is DB1.DBX0.0 thru DB1.DBX0.6 are set. I just want to set one bit and shift it with following zeros. I called the Siemens hotline and it seemed they were not too familiar with this instruction and really could not help me very much. Maybe I am just doing something wrong. I would appreciate any help.
 
You don't have to use the FC for shifting. There are several instructions for shifting and rotating in the main instruction browser in the Shift/Rotate folder. Just highlight one of the instructions and hit F1 to get instruction on its use.
 
I need the SHRB to do the shifting
because i am tracking multiple objects
through a process. This process measurement
units is in millimeters. The length is
approximately 240 inches or 6096 mm. Each
bit is to represent 1 mm or if i have to
1 inch. I have done this before with Allen-Bradley and Siemens-TI 505 processors. I am not partial to one PLC
but Siemens S5/S7 does make it difficult to
do the simpilest tasks.....
 
Are you triggerring the block with a one-shot?

Leaving it enabled will cause it to shift every scan.

One other thing to note about this function, if using it against words in a DB, is that it's shifting functions are byte-swapped (/sigh). One more gotcha
 
Last edited:
Zombo, I just tried out the function, and it works as described. I think the confusion comes from the use of I0.0 in the help file. I found that the EN command needs to be a one-shot, which is inappropriate use for a real world input. For what it's worth, for my test I used the following values:

M50.0= Data
M50.1= Reset
M50.2= EN
P#52.0= S_Bit
M50.3= ENO
W#16#20= N

By one-shotting M50.2, the bits shifted ok.

Actually, a person could come up with a better function on their own, but if you need one right now and it solves your problem, this should work ok.
 
Thanks for the help! I guess I still am
not in the S7/S5 frame of mind. In the
AB register the bit shifts one time even if the shifting command bit stays on. Here it shifts every scan cycle. I wish the S7 help would be a little more precise in the descriptions.I know the manuals are this way too. Always assuming people know... Most of the people referring to S5/S7 manuals seem to say the same thing. Always skipping or missing a step...
 
I haven't read many of the S7 manuals, but from what I have seen of them, I have to agree. What Siemens should really do is take a novice programmer, give him a PLC and the manual, and tell him to write some code. It shouldn't take them long to see where their manuals fail.

That said, don't give up hope with S7. It really isn't difficult, but it is "different". Once you get a handle on it (especially STL programming), you'll be impressed with how powerful and quick it is to program with. Also, try making some of your own "canned" functions instead of using their standard function libraries. Then, you can make them work any way you want them to.
 
Hello,

N Input WORD I,Q,M,D,L,P Length of shift register (number of bits to be shifted).

copied from my help file.

So if you have N = 7, then i can imagine that bit 0 upto 6 are set. I think you should try with N = 1.
 
With all respect you are wrong. The "N"
as shown is the LENGTH of the shift register. All I wanted to do is set one
bit and shift it one place everytime the "EN" input was triggered. RDRAST and S7GUY correctly solved the problem. Without the one shot all seven bits would
be set. One every processor scan. If the
"N" number would be "1" I would have a shift register with a length of one.
What application could I use with that?

FC92 Parameters

Parameter Declaration Data type Memory area Description
EN Input BOOL I,Q,M,D,L Enable input with signal state of 1 activates the box.
ENO Output BOOL I,Q,M,D,L Enable output has a signal state of 1 if the function is executed without error.
DATA Input BOOL I,Q,M,D,L Source data bit.
RESET Input BOOL I,Q,M,D,L Resets the shift register when set to 1.
S_BIT Input *Pointer I,Q,M,D Points to the starting bit in the shift register.
N Input WORD I,Q,M,D,L,P Length of shift register (number of bits to be shifted).
* Double word pointer format for area-crossing register indirect addressing
 
I also have one more question about the
FC92. What is the maximum length a shift
register can be? This would be the "N"
number. I asked the Siemens hotline this question but they did not know.
 
The maximum length is 32767 bits. If you input something higher (greater than hex8000), then it's interpreted as a negative number and the function stops shifting.

Something else that is odd (and which makes it different from the SRD and SLD functions), is that it starts at bit 0 instead of bit 7. This is ok as long as you expect it, but if a person is used to bringing up a VAT table and seeing the consecutive bits scroll across the screen, then it won't look like a true shift register.
 
I tried that 32767 which is 7FFF hexadecimal and a processor error
occurs. I am running the test on a
S7-315-2DP PLC. It seems the maximum
I can get it to run is in the 2000-2250
range (decimal). After that it faults.
Any ideas why? The FC92 is the cause
of the fault I checked the diagnostic buffer.
 
Did you make sure your data block is at least 32767 bits long? If not, you will get an addressing error.

This is exactly why I like to create my own functions. If I use someone else's, since I can't see the internal workings of it, it might "blow up" unexpectedly a year later due to something I couldn't foresee. It would have been very simple in this case for the programmer to verify the length of the data block and return a fault if the shift register length was too long.
 
I had the DB set at 6000 bits before you
sent the suggestion about 32767. Just for
curiousity I put 32767 bits in the DB.
Same result. FAULT. As I said before you
can set it up to the 2000-2250 (decimal) range then after that it faults.
 

Similar Topics

The past week we received a new piece of equipment from Germany which utilizes siemens controls. Typically in our company we use A.B. controls for...
Replies
6
Views
115
Hello I have a s7-1200 and I would like to read the tags present in this controller with my controllogix controller. The two controllers don't use...
Replies
5
Views
134
Hi need help why this “failure 5 emergency stop “ appears at every startup in the morning ? Have to shut off main switch at least 10 times on...
Replies
19
Views
296
i have two plc 1. s7-1212dc/dc/dc ip; 192.168.0.1 2. s7-1500 1513-1pn ip; 192.168.3.2 i need to get data from plc1 to plc2. any idea how to do...
Replies
5
Views
109
Hi everyone hope you'll well. Is it possible for me to download a Crack version of tia portal v13..sorry to say this but the software is very...
Replies
5
Views
198
Back
Top Bottom