EasyManuals Logo
Home>Allen-Bradley>Controller>Logix5000

Allen-Bradley Logix5000 Reference Manual

Allen-Bradley Logix5000
708 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #313 background imageLoading...
Page #313 background image
Rockwell Automation Publication 1756-RM003N-EN-P - October 2011 313
Move/Logical Instructions (MOV, MVM, BTD, MVMT, BTDT, CLR, SWPB, AND, OR, XOR, NOT, BAND, BOR, BXOR, BNOT) Chapter 7
Example 1: The three SWPB instructions each reorder the bytes of DINT_1 according to a different
order mode. The display style is ASCII, and each character represents one byte. Each
instruction places the bytes, in the new order, in a different Destination.
Relay Ladder
Structured Text
SWPB(DINT_1,REVERSE,DINT_1_reverse);
SWPB(DINT_1,WORD,DINT_1_swap_word);
SWPB(DINT_1,HIGHLOW,DINT_1_swap_high_low);
Example 2: The following example reverses the bytes in each element of an array. For an
RSLogix 5000 project that contains this example, open the
RSLogix 5000\Projects\Samples folder, Swap_Bytes_in_Array.ACD file.
1. Initialize the tags. The SIZE instruction finds the number of elements in
array and stores that value in array_length. A subsequent instruction uses
this value to determine when the routine has acted on all the elements in
the array.
2. Reverse the bytes in one element of array.
· The SWPB instruction reverses the bytes of the element number that is
indicated by the value of index. For example, when index equals 0, the
SWPB instruction acts on array[0].
· The ADD instruction increments index. The next time the instruction
executes, the SWPB instruction acts on the next element in array.
3. Determine when the SWPB instruction has acted on all the elements in
the array.
· If index is less then the number of elements in the array (array_length),
then continue with the next element in the array.
· If index equals array_length, then the SWPB has acted on all the elements
in the array.

Table of Contents

Other manuals for Allen-Bradley Logix5000

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Allen-Bradley Logix5000 and is the answer not in the manual?

Allen-Bradley Logix5000 Specifications

General IconGeneral
BrandAllen-Bradley
ModelLogix5000
CategoryController
LanguageEnglish

Related product manuals