RS500 Bit Shift

kjacoby

Member
Join Date
Jul 2011
Location
Right Here
Posts
91
Good afternoon. I am working on setting up a position shift through a PV on a motoman robot. I already have a working solution, but I am trying to find out if there is a cleaner way.

I am currently taking 4 integers from a PV.

Robot 1 shift X
Robot 2 shift X
Robot 1 shift Y
Robot 2 shift Y

I am sending the values, 0-13 to the Slc500 5/05.

I am then multiplying the integers to shift them left so I can do a masked move to my output table.

So to shift 3 of the offsets I multiply by 16, 256, and 4096. I then have a MVM masking so I can copy the integer value to the correct Group Input on the robot.

The problem comes with my Integer value having a max of 32767. If I multiply my largest 4 bit value of 15 by 4096, I get 61440. Since the last bit is a sign, my integer file cannot accept that value. I have tried several different values, and have not been able to come up with an solution, that will take the first 4 bits, and place them to the last 4.

The first 3 offsets work perfectly. This last on was just a pain. The way I got around this is to multiply by 2048, to get my 1 away, and then perform a BSL to shift it that last spot, without an arithmetic overflow.


Is there a cleaner way to get this? If I had a DINT or a long available, I would have been done a lot sooner.

Thanks,
Kenneth
 
Your solution is more elegant but wouldn't it be simpler to brute force it with sixteen xic-ote rungs? Especially when some poor simple sparky comes along to troubleshoot it later?
 
I Like it Jerry! Such a simple solution. I tried so hard to get my original version working, that never crossed my mind.

I attached 2 images, 1 from the first 3 sets, and the solution for the last set. Hopefully they attach.

Kenneth

1.JPG 2.jpg
 

Similar Topics

Can anyone guide me through the download and setup of vmware workstation 8 and rslogix 500 standard edition? I am running windows 7 pro 64 bit,
Replies
1
Views
1,459
Hello I am trying to make a program work with a sqo instruction .The process has 5 steps ,and a starting step of zero.There should be 8 sec...
Replies
17
Views
972
I have upgraded an old RS500 project to Studio 5000, it has thrown multiple errors which I am currently working through. I have looked through...
Replies
8
Views
1,706
I am working on upgrading a system with a ML1500 that uses a 1769-SDN DeviceNet Scanner to a CompactLocix L24ER-QB1B. Due to cost, I need to...
Replies
2
Views
1,389
I have been ask to check if we can have both English and Chinese in the same I/O description text window and rung comments. I could not Chinese to...
Replies
2
Views
1,203
Back
Top Bottom