Shift right with carry

pauly

Member
Join Date
May 2002
Location
South Wales,U.k
Posts
244
:D If I wanted to shift the binary equivalent of say FFFAH one place to the right and check the status of the LSB that's been shifted out
how can this be done within Mitsubishi Fx series plcs?I have tried dividing by 2 and checking the remainder register and this works fine with decimal but I get strange results when working in Hex.Any ideas?
 
Pauly,
M8022 will come on. This is the carry flag. If the LSB was true when it got shifted then M8022 will be true and if the LSB was false when the shift occurs then M8022 will be false.
Good Luck
Tim
 
BTW,
This M8022 carry flag will come on with any other functions that use the carry. It also uses the MSB and LSB. Just thought I would share this with you just in case you have other instructions that use the carry flag.
Tim
 
Shift Right with carry (Cntd)

:cool:First of all thanks to Tim for the reply,I have used the special flag M8022 with no problem,my question was how to shift a binary eqivalent of a no. for example fffa one place to the right?
There doesn't seem to be a function for this within Mitsubishi Fx.
When I try and divide by 2 to achieve the same thing with a 16 bit no.the contents of the result register ends up with ffff as well as the remainder register.A decimal no.works fine though.
 
If I wanted to shift the binary equivalent of say FFFAH one place to the right and check the status of the LSB that's been shifted out
I'm not shure what your getting at. I thought I answered your question, but I may be misunderstanding you. Look at this diagram and let me know if I'm close to your problem.
Tim

binary1.jpg
 
I know you are talking Mitsubishi and I have never dealt with one at all. Does it allow you to use Hex to do division OR do you have to convert it to binary or integer then convert the result to HEX? Not knowing the instruction set I think I understand the shift part but what I dont understand is can the plc know what number in HEX to move, if so how do you make it use hex numbers instead of binary or integer in the code?

This may be too in depth to explain but if you can I would appreciate it. I know many plc's offer the ability to use binary, BCD, integer or hex in the code but I am not sure in this case how the change is done. The other thing I am wondering is "why" you would need to use HEX or are there situations where its used in place of BCD.

So many questions.
 

Similar Topics

So I have a device that uses the last 14 bits of a word for the process value. Bit 0 and 1 are used for a different purpose. what is the best...
Replies
7
Views
2,335
Hi everyone im a student from mexico and i have a problem using the ladder function BSR AND BSF (BIT Switch left and right), I use connected...
Replies
3
Views
2,959
trying to figure out how to start at bit 29 look at a input if it is true set bit 29 to 1 and bit shift right y = 536870912 ' bit 29 set to 1 x =...
Replies
2
Views
1,582
I have an application where I need to detect a bad product on a conveyor, and then reject the bad product off of the conveyor. The conveyor does...
Replies
6
Views
6,635
I've got a Powerflex 700 that doesn't like to get going in the mornings. This motor will run anywhere from 30 seconds to 5 minutes before it just...
Replies
3
Views
154
Back
Top Bottom