BSR and Bit Shifting

M

Thread Starter

Marcos

Hello there,

I am currently a student taking a PLC class at college..

yesterday we covered the topic of bit shifting...

the BSR instruction was kind of confusing, it works in a weird way...

my question to y'all is...

in what situation would you use a BSR?

i'm just curious...
 
B

Bob Peterson

I agree these types of instructions are confusing. I avoid using them if at all possible.

They are sometimes handy for keeping track of when there is a part at a particular station as it goes through a machine.

Or where a bad part is as it goes thru the machine.

--
Bob
http://ilbob.blogspot.com/
 
G

Gerald Beaudoin

A couple of applications come to mind.....usually found to logically represent the progress of a product as it moves through the sequential stations of a machine. Depending on whether or not a bit is turned on/off at a given bit position, various operations can be enabled/disabled. Have also seen the instruction used as part of a conversion routine where one coding format is disassembled or converted to another format by examining just the lower X bits of a word.

Cheers
 
I
Bit shift command can be used on Sequence Control or Batch Control, logic
"1" is become an active sequence/step
while "0" are an unactive sequence/step.

When current step/process completely finished, I can progress to next step/process by move the "1" to MSB using shift left, next step will be executed.

Or I can move back to previous step if my current step/process is fail and the operating procedure need to re-start previous process, so I move "1" to LSB using shift right, previous step will be -restarted.

Another implementation is for format data change from "Litle-Endian" to "Big-Endian". Big-endian systems are systems in which the most significant part of the data is stored in the smallest address given and the least significant part is stored in the largest. In contrast, little endian systems are those in which the least significant byte is stored in the smallest address

This is usually implemented on Modbus communication system which is use Integer (16 bit) data.

If DINT (32 bit) need to transfer through Modbus, because Modbus use INT data for each address this data should be separated into 2 INT data and keep on 2 consecutive address.

let say, If the transmitter use little endian, MSB word will be kept on biggest address and LSB word will be kept on smallest address.

Then in the receiver side, the two address will be reconstructed into DINT. Because receiver implemented big endian, the MSB and LSB part of DINT data need to be swapped before the value read. Shift left 16 bit command or shift right 16 command can be used to swap MSB and LSB of this DINT data so then the value will be correctly read.
 
W

William Sturm

I've used the BSR to track pallets on a conveyor, each full pallet has a 1 for the bit value.  As the conveyor moves from station to station, the bits are shifted with the BSR or BSL instruction to stay in sync with actual pallet positions.  You can also use the OTL and OTU instructions to set and reset bits inside the shift register as needed.
 
Top