The BSL instruction

tomfarvour

Member
Join Date
Aug 2007
Location
Green Bay
Posts
36
Hello all, I have a quick question regarding some numbers in my MicroLogix 1500 project.

Basically here is the situation. We have a quartech 2800 keypad which is going to store a double word in to two consecutive PLC registers (N97:5 and N97:6) so we can get a nice big number from the OIT.

However, the quartech doesn't understand the L file type (32-bit long) so once the data is put in to the two registers, what is the easiest way to move/"convert" the two N97:5 and N97:6 registers in to one larger L97:0 register, for example?

I was told the BSL would do it, but I don't know how to use it. If BSL is not the answer, what would be?
 
DISCLAIMER: I have no expreience with the 1500.

You may be able to simple COPy the two integers into the double integer.

Typically, in A/B processors, the COPy instruction uses the destination address to determine the length of the COPy, so if you COPy Source: N97:5 Destination L99:0 Length: 1, the instruction will copy N97:5 and N97:6 to the destination L99:0.

You will need to check the manuals to ensure that I am correct in my assumptions about the COPy command in your particular processor.

The BSL sounds like "the long way to Grandma's house". You would have to perform 32 BSL instructions to get all the bits in the correct order into the L word.

Again, I recommend that you RTM for your controller unless another more experienced ML1500 user posts a more accurate response.

Also, it is occasionally necessary to swap the positions of the two 16 bit integers to get the correct result. Some PLCs provide a SWaP instruction, others may require you to do that prior to your COPy.

Good Luck!
Paul
 
OkiePC said:
DISCLAIMER: I have no expreience with the 1500.

You may be able to simple COPy the two integers into the double integer.

Typically, in A/B processors, the COPy instruction uses the destination address to determine the length of the COPy, so if you COPy Source: N97:5 Destination L99:0 Length: 1, the instruction will copy N97:5 and N97:6 to the destination L99:0.

You will need to check the manuals to ensure that I am correct in my assumptions about the COPy command in your particular processor.

The BSL sounds like "the long way to Grandma's house". You would have to perform 32 BSL instructions to get all the bits in the correct order into the L word.

Again, I recommend that you RTM for your controller unless another more experienced ML1500 user posts a more accurate response.

Also, it is occasionally necessary to swap the positions of the two 16 bit integers to get the correct result. Some PLCs provide a SWaP instruction, others may require you to do that prior to your COPy.

Good Luck!
Paul

Unfortunately, I get the ERROR operand sizes don't match error. Hmmm, really wish I knew of a nice easy way to do this with the MicroLogix 1500 series. Someone had suggested the MVM but I get the same error regarding the operand sizes...
 
I found that I can use a CPW instruction to copy N27:0 in to L29:0, then do 16 BSLs (using a counter in a loop system), and then CPW the N27:1 in to L29:0 when it's all done.

It /appears/ to work, but I'll have to test it with our keypad to make sure that I get the intended result.

i.e.: a customer enters in 88333 in to the keypad... ultimately my L29:0 should contain "88333" in decimal...

-Tom
 
First, if you can mix data types in the 1500 using CPW, why can't you alter the length to get them both copied at once? My reading of the instruction help file leads me to believe that CPW length is specified in words, which, to me, means 16 bit elements. So, if I am not mistaken, this should work:

EDIT: I see, acoording to your last post, that the 16 bit integers are not in the correct order, so you would want to copy them into correctly ascending locations first...something like MOVe Source: N27:0 Dest: N27:2, then CPW Source: N27:1 Dest: L99:1 Length 2 instead of what I have here:

CPW Source: N27:0 Destination: L99:1 Length 2

If that won't work, how about:

CPW Source: N27:0 Destination: L99:1 Length 1------------'Puts N27:0 in the least significant 16 bits...
MULtiply Source A: L99:1 Source B: 65536 Destination L99:0------------'Moves the value to the higher 16 bits...
(OSR) ADD: Source A: L99:0 Source B: N27:1 Destination L99:0------------'Puts the value from N27:1 into the least significant 16bits...
 
Last edited:

Similar Topics

I’m working on a conveyor project for work. We’re trying to install a few diverts to carry product directly to one of two trailer doors. I have...
Replies
5
Views
1,050
Hello everyone! I am in the middle of converting an RSLogix 500 program to RSLogix 5000. I made an array of INTS called B3 and have been using...
Replies
3
Views
1,814
I am using the BSL instructio in a micrologix 1500. It always indexes from the 35th word bit 0. For example N17:35/0 will be where it loads the...
Replies
7
Views
3,269
I am experimenting with the BSL instruction in LogixPro and have run into a problem. The goal of my program is as follows: track bad products...
Replies
14
Views
13,759
Ok, I got my BSL instruction doing what I want it to do, kinda. I am using it in a ML1000, in the instruction set reference manual it says "If...
Replies
7
Views
3,006
Back
Top Bottom