Create the product_info data type, Search for the characters – Rockwell Automation Logix5000 Controllers ASCII Strings Programming Manual User Manual
Page 21
![background image](/manuals/579884/21/background.png)
Processing ASCII characters Chapter 2
Create the PRODUCT_INFO Data Type
To create a Product_Info user-defined date type in the Controller Organizer,
right-click User-Defined and click New Data Type. Configure the user-defined
data type as follows.
Data Type: PRODUCT_INFO
Name
PRODUCT_INFO
Description
Identifies the destination for an item based on an ASCII string of characters that identify the
item
Members
Name
Data Type
Style
Description
Product_ID
STRING
ASCII characters that identify the item
Lane
DINT
Decimal
Destination for the item, based on its ID
Search for the characters
You can search for characters by creating the following ladder logic routine.
The SIZE instruction performs the following:
•
Counts the number of elements in the sort_table array (type
PRODUCT_INFO). This array contains the product ID for each item and
the corresponding lane number for the item.
•
Counts the number of elements in Dimension 0 of the array. In this case,
the only dimension.
•
Sets the Length of the subsequent FSC instruction equal to the size of the
sort_table array.
The FSC instruction searches each Product_ID member in the sort_table array
until the instruction finds a match to the product_id tag.
Rockwell Automation Publication 1756-PM013D-EN-P - October 2014
21