EasyManuals Logo
Home>Allen-Bradley>Controller>Studio 5000 Logix Emulate

Allen-Bradley Studio 5000 Logix Emulate User Manual

Allen-Bradley Studio 5000 Logix Emulate
676 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 #655 background imageLoading...
Page #655 background image
Chapter 11
Rockwell Automation Publication MOTION-RM002H-EN-P-February 2018 655
Example 1
If you want this Enter this structured text
Clear bits 0…31 in an array of BOOLs:
Initialize the subscript tag to 0.
Clear i . For example, when subscript = 5, clear array[5].
Add 1 to subscript.
If subscript is ≤ to 31, repeat 2 and 3.
Otherwise, stop.
For subscript:=0 to 31 by 1 do
array[subscript] := 0;
End_for;
Example 2
If you want this Enter this structured text
A user-defined data type (structure) stores the following information about an
item in your inventory:
• Barcode ID of the item (String data type)
• Quantity in stock of the item (DINT data type)
An array of the above structure contains an element for each different item in your
inventory. You want to search the array for a specific product (use its bar code)
and determine the quantity that is in stock.
1. Get the size (number of items) of the Inventory array and store the result in
2. Inventory_Items (DINT tag).
Initialize the position tag to 0.
3. If Barcode matches the ID of an item in the array, then:
Set the Quantity tag = Inventory[position].Qty. This produces the quantity in
stock of the item.
Stop.
Barcode is a string tag that stores the bar code of the item for which you are
searching. For example, when
position = 5, compare Barcode to Inventory[5].ID.
4. Add 1 to position.
5. If position is ≤ to (Inventory_Items -1), repeat 3 and 4. Since element
numbers start at 0, the last element is 1 less than the number of elements in
the array.
Otherwise, stop.
SIZE(Inventory,0,Inventory_Items);
For position:=0 to Inventory_Items - 1 do
If Barcode = Inventory[position].ID then
Quantity := Inventory[position].Qty;
Exit;
End_if;
End_for;
Use the WHILE_DO loop to keep doing something as long as certain conditions
are true.
Operands
WHILE bool_expression DO
<statement>;
WHILE_DO

Table of Contents

Other manuals for Allen-Bradley Studio 5000 Logix Emulate

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Allen-Bradley Studio 5000 Logix Emulate and is the answer not in the manual?

Allen-Bradley Studio 5000 Logix Emulate Specifications

General IconGeneral
BrandAllen-Bradley
ModelStudio 5000 Logix Emulate
CategoryController
LanguageEnglish

Related product manuals