Skip to content

Using a Barcode Scanner to Select an Image & Initiate Programming

Introduction

PEmicro's Cyclone FX programmers are capable of using a barcode scanner during stand-alone programming. Scanned barcodes can be used to automatically select and program a specific SAP (Stand Alone Programmer) image into a target. This means the programming image does not need to be pre-selected before programming. Also, there is no need to hit the start button. Simply scan the barcode and programming will be initiated.

The Cyclone FX scans the barcode and checks all resident images for a barcode match. If exactly one match is found, the image is selected and used to program the target. If no matches are found, or multiple matches are found, an appropriate error is reported. This reduces manual configuration errors especially when large numbers of programming images and product types may be programmed.

Automatic selection and launch of a specific flash programming image based on a scanned barcode can improve the speed and accuracy of production programming, especially in environments with a varied product mix. Barcode scanning helps reduce user error by making image selection fast and automatic.

The barcode itself can optionally be programmed into the target device's memory as part of this manufacturing process. The information that the barcode makes available to the device can make it easier to trace products, track product hardware versions, or provide a way to serialize production. This results in a more efficient manufacturing process.

Scanning Procedure

After the Cyclone FX is configured (see Enabling Barcode Scanner In Cyclone Menu), the barcode scanner is connected to the Cyclone's host USB port. The scanner is used in Wedge output mode, which emulates a USB keyboard. When the scanner scans a barcode, it transmits the barcode to the Cyclone. The Cyclone then analyzes the barcode and uses it to select a programming image.

To perform this analysis, all programming images on the Cyclone, in both internal and external memory, are reviewed. Each image may contain a set of rules to determine whether a scanned barcode corresponds to that particular image. This set of barcode analysis rules is referred to as an image's "barcode test." If the barcode passes the test on one and only one of the programming images on the Cyclone, that image is automatically selected and programming is initiated. Otherwise, if the scanned barcode does not pass the barcode test on any image, or if it passes the test on more than one image, an error will occur.

Barcode test rules include: barcode length, character type, specific characters, and numerical ranges. Fixed barcodes or barcodes which are unique to an individual product can be properly analyzed and used to select the appropriate programming image.

A logfile is generated to help the user understand how a scanned barcode auto-selects a specific image on the Cyclone (or yields an error). See Troubleshooting for more information on this logfile.

Figure: Cyclone FX With Barcode Scanner

image09

Potential Benefits Of Programming Via Barcode Scan

The use of a barcode scanner as part of the manufacturing process can boost productivity and reduce human error. When the user scans a barcode to select and launch the programming sequence, it frees that user from having to know any details about the product being programmed; point, shoot, and it programs. Programming multiple products with different data can be as simple as connecting each new target board and scanning a barcode that is printed on it.

A manufacturer might, for example, design their products such that every product has a unique barcode printed on it. Part of these barcodes might be a fixed string, and part of them might be changing (for example :WIDGET1-A00143, WIDGET1-A04325, WIDGET1-B03222). In this scenario, the barcode test for the WIDGET1 programming image could check that the barcode starts with the fixed string "WIDGET1-" (product identifier), the next character is an A or B (product version), and that the rest of the barcode is numeric (unique ID). If it passes, the WIDGET1 image would be selected and the target programmed.

This same manufacturer might also set up the programming process for each product to program the barcode itself at a specific point in memory. There are then many ways a device could leverage its barcode number. For example, the running application in the device could check the product version of the barcode to understand whether it is running on hardware revision A or B and make decisions based upon that information. The Unique ID could also be used for this purpose. E.g., if the number is less than 5000, then use high drive strength on the product's port X; otherwise use low drive strength on the product's port X. When connected later to the cloud, it can report its unique identifier back to its home base. Potentially, it could use the barcode's Unique ID as part of setting up its MAC address for Ethernet.

Figure: Bar Code Scanner On Production Line

image05_new

In a completely different programming scenario the manufacturer might not want to place barcodes on the products themselves. E.g., it could be that they do not frequently switch from one product to another on the production line. In this case, they might prefer to create a separate set of directions for each product they manufacture which covers programming, test, and casing of the product. They could then include a fixed barcode as part of the programming instructions. The instructions might state that, before starting a production run of this product the barcode should be scanned by the Cyclone programmer. This removes the manual step of the operator choosing which image to use for each product. The Cyclone selects the image automatically by using the barcode in the instructions (and if there is not a unique match, an error is reported). This can help to reduce user error, particularly if the programming images on the Cyclone carry similar names.

Enabling Barcode Scanner In Cyclone Menu

To use the barcode scanner with a CYCLONE FX, the scanner must first be enabled in the Cyclone menu by navigating to "Configure Cyclone" and then "Configure USB Host Device." The user should click on "Enable USB Scanner". The barcode scanner's instructions should be consulted to understand how to put the scanner into Wedge (keyboard emulation) mode, and to make sure that it terminates the barcode with a CR (carriage return) character. The scanner can then be plugged into the USB host mini connector on the side of the Cyclone. A USB-to-USB-Mini adapter may be necessary if the scanner uses a full-sized USB connector. When plugged into the Cyclone, the scanner will power up and the Scanner Active icon on the Cyclone LCD screen will illuminate.

Barcode Scanner Active icon: scanner detected

Creating A Barcode Test: Quick Example

This section demonstrates one simple example of how to create a barcode test by using the Barcode Test Generator utility. For in-depth instructions on how to use the Barcode Test Generator, please refer to Creating a Barcode Test: In Depth.

Whenever a programming image is created the user has the option to add a barcode test to the image. PEmicro provides a Barcode Test Generator utility to enable the user to create these tests. The following steps demonstrate how to create a sample barcode test.

To begin, the user should launch the Barcode Test Generator utility. The user should then write a prototype of the expected barcode in the "Sample(ascii)" section. In this example, the prototype barcode is "P&E MICRO-TEST1-0000". See the figure below. Please note that this example only demonstrates one simple approach to creating a barcode; there are many methods available.

Figure: Create Prototype Barcode

image04_crop

In this example, the "P&E MICRO" portion of the prototype barcode exists in every barcode the company produces - in this case, header characters that identify the company. Also for this example, a product identifier "TEST1" is in the barcode. Following the identifier, this product also has a 4-digit serial number. This completes the prototype barcode which is representative of this product's barcodes.

The next step is to use this prototype barcode to create barcode tests which will be run against scanned barcodes. In this example, the first test should check the header (i.e. "P&E MICRO") at the beginning of the barcode. To enable this, the user should click the small down arrows corresponding to the header section of the barcode. This creates a character test for "P&E MICRO". This string will need to match exactly for the barcode test to pass. The "FC" designation on each character stands for "Fixed Character" with the actual value shown below it. See the figure below.

Figure: Create Char Test For "P&E MICRO"

image06_crop

The next test will check whether the scanned barcode matches the product identifier "TEST1" exactly. The user should click the small down arrows for the "TEST1" characters to bring them into the Char test section.

Figure: Create Char Test For "TEST1"

image07

The "1" in "TEST1" is by default treated as a "Numerical Character" for testing reasons ('NC'). This means it is required to have a value of '0'..'9'. To restrict the value of this character, it could either be changed to a fixed character test or we can restrict the range of acceptable values. To do the latter, click on the down arrow below the character test and bring the "1" character into the Range-1 test area. Both the lower and upper bounds for this character can then be changed to "1" so that the match must be exactly the number 1.

The final step is to create a test for the 4-digit serial number part of the prototype. In this example, only 501 units of this product will be manufactured which correspond to a specific programming image, each with a unique serial number from 0000 to 0500. The test should make sure that this limit is not exceeded. Therefore, the user should add "0000" to the Char Test by clicking on the small down arrows for the characters. This should then be converted into a Range test by clicking on the new arrows to add these four characters to the Range-1 test area.

Figure: Create Range-1 Test

image03_crop

The default for the range test is 0000 to 9999, so after these numerals enter the Range-1 test area, the user should change the upper bound from 9999 to 0500. Any continuous numerical digits are considered to be one numerical value for the purpose of range comparison.

The result in the Barcode Test Generator utility should look like the figure below:

Figure: Completed Barcode Test

image00_crop

This completes setup of the barcode test. The user should now click on "Save File As" on top and name the test "Test1_barcodetest.bar". This test is now ready to be added to a programming image using the Cyclone Image Creation utility.

Creating a Barcode Test: In Depth

This section is an in-depth exploration of how to use the Barcode Test Generator utility to create a barcode test. For a quick example of how to create a barcode test, please refer to Creating A Barcode Test: Quick Example.

The ability to select a programming image and initiate programming via a barcode scanner requires that a user generate a Barcode Test that will be included in the programming script of the SAP image. In order to create the Barcode test, PEmicro supplies a Barcode Test Generator utility that facilitates creating a Barcode Test which describes the mechanism for calculating whether an input barcode meets the criterion the user is looking for to be considered a match, which can be an exact match or a match that is in a Range selected by the user.

The Char Test(TYPE): and Range test fields are defined by selecting characters from the Sample (ASCII) input. The intended workflow is for the user to enter a complete sample barcode and then create the appropriate tests from it. Char Test(TYPE): is used to restrict individual characters to specific types, such as numeric, alphabetic, or hexadecimal. Range tests are used to determine whether a selected set of Sample input characters, treated as a single large number, falls within specified lower and upper bounds. These Range tests are typically used to validate sequence numbers. For a barcode test to be valid, it must pass all defined Char Test(TYPE): checks and, if any Range tests are present, at least one Range test. Range tests are performed on Sub-Ranges, which are defined as contiguous sets of characters that all share the same Char Test(TYPE):. The figure below shows a typical main screen for the Barcode Test Generator utility.

Figure: Typical Barcode Test Generator Main Screen On Startup

Opening Main Screen

Barcode Test Creation and Testing Process

A Barcode Test can be easily created and tested using the following 8 simple steps which are explained in the paragraphs following the list below:

  1. Create a Sample(ascii)/(hex) Barcode
  2. Select Characters to be tested by copying them to Char Test(TYPE):.
  3. Set desired type of selected characters from step 2.
  4. Copy character types from step 3 to Range-1 or Range-2 if Range testing.
  5. Adjust range character(s) minimums and maximums of character of Step 4.
  6. Press the DO TEST button to test the Sample against test setup.
  7. Make changes to Sample, Char Test(TYPE), Range-1, or Range-2 and repeat steps 6 and 7 until an acceptable test has been created.
  8. Save the test to a Barcode Test (.bar) file for later use.

The Sample character set is used first as a structural frame for creating a Barcode test and then later as an input field for entering multiple barcode samples to verify the Barcode test works as expected.

Enter a Sample(ascii)/(hex)

Sample characters can be entered either as ascii characters or hexadecimal bytes (2 characters per byte) and in many ways. To start the process, click on either a Sample(ascii) box or a Sample(hex) box. This makes the box darker blue to indicate where the entry cursor is. Once the entry cursor is set characters can be entered into the Sample by several methods listed below. When entries are placed in a Sample(ascii) box they are also updated in the corresponding Sample(hex) box and vice versa:

  1. By simply typing in ascii characters or pairs of hexadecimal characters.
  2. By copying a string of highlighted characters by Ctrl-C / Ctrl-V method.
  3. By scanning in a string of characters starting at the current cursor position.

Figure: Typical Sample Entry Screen Section

SampleEntry

The figure above shows a typical entry screen section. The first line gives the character numbers. The second line shows entered characters and un-entered characters in ASCII. The third line shows the entered characters in hexadecimal, and the current cursor position. The last line shows a set of down arrows which when clicked on selects the characters to be tested.

Sample characters are deleted by double clicking on a Sample(ascii) or Sample(hex) box . For convenience, the entire set of Sample characters can be deleted by double clicking on the left screen Sample(ascii): button. As characters are entered, the cursor automatically moves to the right stopping at the last Sample entry box to add additional character boxes.

When characters are entered into a Sample(ascii) box, the background color of the box is changed to Light Purple. This is done to highlight the difference between a space character and un-entered boxes. At the same time, a down arrow is placed under the Sample(hex) box to indicate that the Sample character can be transferred to a Char Test(Type): field by clicking on the down arrow.

Sample entry by typing in Characters

If the cursor is in a Sample(ascii) box typing in characters will place them in that box. The cursor is then automatically moved to the next Sample(ascii) box. All ASCII characters including control codes can be entered in Sample(ascii) boxes. However, if there are characters stored on the desktop, a Ctrl-V will enter them rather than entering a Ctrl-V character. After two Sample(hex) box character entries, the cursor automatically proceeds to the next Sample(hex) box. Only the hexadecimal characters, (0-9, A-F, a-f), are allowed in a Sample(hex) box. Hex values are entered high nibble and then the low nibble.

Sample entry by copying in a string of highlighted characters

A string of characters can be entered into a series of Sample(ascii) boxes starting at the cursor by first highlighting them by a mouse down pass over of the characters, then doing a Ctrl-C and a Ctrl-V. This is a standard Windows System process of placing a string on the desktop and then inserting it somewhere else. However, you cannot do this with characters within the utilities window.

Sample entry by scanning in a string of characters

Most barcode scanners can place the scanned characters into the Windows keyboard buffer. Hence, they are automatically entered into a sequence of Sample(ascii) boxes starting at the cursor. Make sure when setting up a scanner that it is configured to place the scanned characters in the keyboard buffer.

Deleting an entry

The contents of an entry box may be deleted by double-clicking on the entry box.

Copy Characters to be tested to Char Test(TYPE):

When a barcode is scanned during production programming, it is often the case that all the characters do not need to be tested to determine the appropriate standalone programming (SAP) image to be used. Hence, it is necessary to select and copy only those Sample characters to be tested.

Figure: Sample Characters copied to Char Test Section

Sample to Test

Simply clicking on the down arrows between the Sample and Char Test(TYPE): Sections of the screen transfers the corresponding character to the test section. The transferred characters are shown as ASCII characters along with an associated type. The ASCII characters in the Char Test Section represent transferred values and do not change when the Sample characters are edited. When transferred from the Sample, the associated type is automatically set to either Fixed Character (FC) type or if asci characters (0-9) to NUmeric (NU) type. All possible character types are defined in Character Types. Any character types which are represented by a contiguous range of values are indicated by a set of down arrows into the Optional Range Restriction Sections of the display.

Figure: Selected Test Char Type(s) Window, shown below, indicates that only the product name "Cyclone-FX", the serial number (SN) "01234", and the revision (Rev-) "B" were selected for character testing. The manufacturer "P&E", blank spaces, and other characters are ignored during character testing.

Note

Each of the fixed characters in 'Cyclone-FX' and 'B' require an exact match, while each number in '01234' only has to be in the NU range of 0-9 to be a match.

All entries in the Char Test field can be deleted by double clicking the Char Test(TYPE): button. Individual Char Test entries can be deleted by double clicking anywhere on them.

Often setting just the Char Test(TYPE): of tested characters to Numeric (NU) or Fixed Character (FC) and setting the appropriate ascii value for Fixed Character (FC) fields is sufficient to generate a barcode test (although the Barcode Test Generation Utility also allows specification of fairly complex barcodes as well).

Set desired type of selected characters

Once Char Test characters have been selected, they can be changed to different types than were transferred from the Sample. An individual associated type is edited by clicking on it to set the cursor position. For example, clicking on the Char Test(TYPE): "B" character type opens the window:

Figure: Selected Test Char Type(s) Window

Selected Test Character

Adding, Changing and Deleting Char Test(TYPE):

This window shows all the character types associated with the selected Char Test character. Shown types can be changed or deleted by clicking on them, or types can be added or deleted by clicking on "click here to add type." If clicked, one of the similar windows shown in the figure below is opened. Types can also be efficiently copied to other blocks as per Ctrl-C / Ctrl-V Char Test(TYPE): and Range Copying.

Figure: a) On Click Add Figure; b) On Click Type Figure; c) On Click Type (multiple types)

Column 1 Column 2 Column 3
addchartype Change_Char_Type_2.3a Change_or_DeleteType

Clicking on one of the opened window selections causes that option to be added, changed or deleted.

Fixed Character ( FC ) and Single Set ( SS ) Sub-Types

Choosing to change either FC or SS type will open respectively the following windows to allow entry of the numeric values of these types.

Figure: a) FC Value; b) SS Values

FC_valueSS_Values

The FC type choice, the left figure above, only requires one value to be entered since a Fixed Character (FC) has the same upper and lower values. The Single Set (SS) type choice, the right figure above, represents a single contiguous set of any length and hence requires both lower and upper bound values. These values can be entered either as ASCII characters or pairs of hexadecimal digits. The fuchsia color indicates that some action must be taken before proceeding.

Multiple Sub-Types

A given Char Test character can have up to a maximum of 10 sub-types. However, if one selects either numerically adjoining or overlapping sub-type sets, the program automatically compresses the sub-types.

For this example, the "Rev-" "B" Char Test(TYPE): was set to allow the characters "A", "B", "D", or "E". This is shown in the left figure below as two SS sub-types. This could have been done by adding three FC types for "A", "D", and "E" or two SS types ["A"-"B"] and ["D"-"E"]. However, the program would compress the FC types to SS types as shown. As can be seen in the right figure below, the "Rev-" Char Test(TYPE): information was changed from an FC type to a MulTiple (MT) type.

Figure: a) Compressed Types for "Rev-" Test Character; b) MT Type Change for "Rev-" Test Character

MTMT_Type

Type Changing Errors

When initially created, a Char Test type always matches the type of character in the corresponding Sample field. However, changing a Char Test type or a Sample character can cause an error. Errors are always indicated by changing appropriate background colors to red. For example, if character number 05 type is changed to NUmeric (NU) the following error would appear on the screen:

Figure: Error from invalid type for Sample character 05

ChangeTypeError

Notice that the Char Test(TYPE): Button is red to indicate a problem in that field and that the specific type character "C" causing the error is also red. Note that it is not the type character which causes the error but the Sample character which is tested against its type. If multiple type boxes were in error, each of the type boxes would be marked in red. These error conditions can be corrected either by changing the Char Test(TYPE): entry or changing the corresponding Sample character. Clicking on almost anything on the screen clears all error indications.

Copy character types from step 3 to Range-1 or Range-2

When Char Test characters were added, down arrows were added only for contiguous types. These down arrows can be used to select which characters from Char Test(TYPE): are added to the two possible Optional Range Restrictions, Range-1 and Range-2. In general, range tests should only be added when the Char Type is not sufficient to test the appropriate values.

The characters added to a range are numerically concatenated together to form a single numerical value which will be compared against specified upper and lower bounds tests. This allows for testing to see if the target should be programmed based upon such things as serial numbers. When not all allowable sequences for the types defined are desired. For instance, if a sequence number from 00000-49999 was desired, but not 50000-99999, a Range restriction can be used. If, however, 00000-99999 was fine for the serial number test, a range restriction is not needed and the five characters are simply defined in the Char Test(TYPE): as Numerical(NU). In most cases, valid range restrictions will probably be restrictions based upon numeric digits. However, any characters: numeric, hexadecimal, alphabetic, control characters, etc. are allowed to form a range.

Down arrows are not provided for a Fixed Character (FC) type since it is usually sufficient for them to be tested as Char Test(TYPE): characters. Down arrows are only shown for contiguous types since non-contiguous types would cause holes in sequence numbers which can be confusing. To bypass these restrictions, see Bulk Copy Option.

Figure: Transfers from Char Test to Range-1

type to range

In the figure above the NUmeric (NU) characters were transferred to the Range-1 test using the down arrows. Only types with contiguous character sets can be transferred this way. When contiguous types are transferred, the upper and lower bounds are set to the type's maximum and minimum values for convenience. However, it is easy to change them later. The MT type was transferred using the bulk copy method since it is non-contiguous. Because of this, care must be taken about missing values in the Range-1 specified. When non-contiguous sets are transferred, the upper and lower bounds are both set to the Char Test(ascii) character value. Such values can be easily changed later.

Adjust Range Character Upper and Lower Bounds

To change upper and lower bound values, first click on either a bound (ascii) box or a bound (hex) box to set the cursor there to that box. Typing an ascii character or a pair of hexadecimal characters enters them into the appropriate box. Then the cursor is moved to the right one block, circularly over the set of range blocks. Pairs of upper and lower bounds can also be copied to other pairs. All entries in a range can be deleted by double clicking the Range-1 or the Range-2 buttons. Individual range entries can be deleted by double clicking anywhere on them.

Figure: Adjusted Range-1 and Range-2 Bounds

range adjust

Notice in the figure above that Range-1 numeric values run between 00000 and 05436. In addition, for Range-1, the lone MT type was adjusted to use only a contiguous range of "A" to "B". Range-1 was adjusted to have the numeric values between 0000 and 9000. Also, its lone MT type was set to a contiguous range of "D"-"E". These choices created only contiguous ranges, i.e. no holes in a range. Ranges which are non-contiguous are allowed if necessary but generate confusing results.

When creating range entries, the Upper Bound should be greater than or equal to the lower bound. If the bounds are not entered that way, an error is generated as shown below in the figure below by changing the background color of the appropriate Range button(s) and the bound(s) entry to fuchsia. This can be fixed by swapping the upper and lower bounds.

Figure: Bounds Entry Error

bound_entry_error

Press the DO TEST button to test Sample(ascii) characters against all tests.

When developing Barcode tests, it is necessary to frequently test to assure that the tests being generated correctly select the appropriate standalone programming (SAP) image. Clicking on the "DO TEST" button causes the CharTest(TYPE): and both Range tests to be run if they exist.

Figure: Program Control Area

Program Control Area

To pass the test, the Char Test and at least one of the Range tests must pass. If the test passes, the background color of DO TEST is changed to green. It is possible for DO TEST to be green even if one of the Range tests is red. Shown in Figure 2.6b is the result of changing the numeric characters to "05444" and clicking on DO TEST Button.

Figure: Passed Test with only One Range Test Passed

Passed Test with only one Range Test Passed JPG

Note that the DO TEST button is green indicating that the test passed. Also, note that the Range-1 button is red which means that the Range-1 test failed but didn't cause the overall test to fail. Additionally, Range-1 character 22, "3", failed the upper bound test.

In the figure above, the Range-2 test passed since when the first character tested (character 20, "5") was greater than the lower bound ("0") and less than the upper bound ("9").

Shown in the figure below is a test of a slightly different sample which failed on many things.

Figure: Failed Test with Multiple Failures

Failed Test with Multiple Failures

Clicking on almost anything on the screen clears all error indications.

Make changes to Sample(ascii) , Char Test(TYPE): , Range-1 , or Range-2 & Repeat Test

This step represents the start of the iterative process used to generate an appropriate test for the product to be programmed. Try different Samples, run DO TEST, make changes to the test, etc., until a satisfactory test is found.

Save the test to a Barcode Test (.bar) file for later use

The tests created can be saved (See Saving and Loading Barcode Test Files.) for later inclusion in a Cyclone FX programming SAP image using PEmicro's image creation utility. The saved tests can also be reloaded for correction or as the base for creating other tests.

Character Types

Selected characters are tested as part of the Char Test (TYPE): to see if they are included in a set of characters called a type. Listed in the table below are the type sets allowed in this program. Most of the types have common names and abbreviated mnemonics. Some types are contiguous and others are not. Contiguous means that there is only a single lower and a single upper count for the set with no missing values. A special type called MT (Multiple Types) means that it is composed of a number of sub-types.

When forming a MulTiple (MT) types, the program will automatically compress either adjacent or overlapping sub-types if possible as they are created. This optimization makes for a more efficient type testing process. In addition, when creating Fixed Characters (FC) or Single Set (SS) types, the program asks for the lower or upper bounds for these sets either as ASCII characters or pairs of hexadecimal digits. FC is the same as an SS with a bounds range of a single character, i.e., the lower and upper bounds have the same value.

Abbreviation Type Character Set Hex Range Contiguous
Abbreviation Type Character Set Hex Range Contiguous
FC Fixed Character selected [hh-hh] Y
SS Single Set selected [ll-hh] Y
AU Alphabetic Upper case [A-Z] [41-5A] Y
AL Alphabetic Lower case [a-z] [61-7A] Y
AB AlphaBetic [A-Z][a-z] [41-5A] [61-7A] N
AN Alpha Numeric [0-9][A-Z][a-z] [30-39] [41-5A] [61-7A] N
NU NUmeric [0-9] [30-39] Y
HX HeXadecimal [0-9][A-F][a-f] [30-39] [41-46] [61-66] N
MT MulTiple Multiples of above Multiples of above N

Background Color Codes

The figure below shows what the color codes typically represent on the program screen:

  • Darker blue, gray, or light purple: Clicked to Select or Double-Clicked to delete
  • Light Purple: Indicates Selected ASCII character values
  • Light Green: Indicates Selected hex character values
  • Red: Indicates a Failure
  • Green: Indicates a Success
  • Fuchsia: Needs attention to continue or indicates inverted bounds
  • Yellow: Marked by Ctrl-C for Ctrl-V copying
  • Dark Blue: Indicates the Cursor position

Figure: Background Color Codes

ColorCodes

Font Color Codes

The figure below shows what the font colors represent on the program screen:

  • Black: Normal character font color
  • Red: Font color selected for Bulk Copying, or to indicate an Option Open Option

Figure: Font Color Codes

FontColorCodes

Enabling/Disabling A Barcode Scanner

To enable a barcode scanner that is connected to the Cyclone FX's USB Extension Port, go to:

Menu -> Configure Cyclone -> Configure USB Host Device -> Enable USB Scanner

This setting is persistent; the scanner will be powered and turned on when the Cyclone is powered, until the scanner is disabled. To disable the barcode scanner, select:

Menu -> Configure Cyclone -> Configure USB Host Device -> Disable

Ranges and Range Testing

Testing is done in two steps. First, if any Char Test(TYPE): characters are specified a Character Type test is done as indicated in Character Type Testing. Then, if either Range-1 or Range-2 has entries, a Range test is done as indicated in Range Testing.

To pass testing, the Char Type(TYPE): test must pass if it exists. In addition, at least one Range Test must pass if any exist; if not, errors are indicated on the program's main screen.

Character Type Testing

Each character in Sample which has a corresponding Char Test(TYPE): is tested numerically to see if it is within one of the sets for the type specified. Types can have multiple sets of characters. As long as the Sample character is in one of the sets, the test is valid for that character. If any individual Sample character test fails, the overall test is failed.

Range Testing

Ranges are subdivided into Sub-Ranges which are delineated by contiguous sets of identical Char Test(TYPE):s. A Range test consists of testing each Sub-Range. A Range test passes if all of its Sub-Range tests pass. Sub-Range testing checks to see if the selected set of Sub-Range Sample characters treated as a large number fits between a lower and an upper bound. The bounds are formed by numerically concatenating the selected Sub-Range bounds boxes, to form a number representing lower and upper bounds for that Sub-Range.

Sub-Range bounds entry boxes are actually tested against their corresponding Sample characters on a character by character basis from left to right until all the individual lower and upper bounds for a given Range are tested:

On lower bounds, starting at the left, if the corresponding Sample character is:

(a) lower than its lower bound, lower bound Sub-Range test failed, do next Sub-Range

(b) equal to its lower bound, next Sub-Range character to the right must be tested

(c) else, lower bound Sub-Range test passed, do next Sub-Range.

On upper bounds, starting at the left, if the corresponding Sample character is:

(a) greater than its upper bound, upper bound Sub-Range test failed, do next Sub-Range

(b) equal to its upper bound, next Sub-Range character to the right must be tested

(c) else, upper bound Sub-Range test passed, do next Sub-Range.

If a range test error occurs, this process helps identify the exact character in the sequence that caused it. This also means that the range is tested as a large concatenated number composed of numerical characters. The test is performed on a character by character basis.

Saving and Loading Barcode Test Files

Barcode Test (.bar) File Structure

PEmicro Barcode Test Data is stored in JSON Data Interchange Format files [2]. The information in an empty PEmicro JSON Barcode Test file is shown below where blue characters represent the formatting information and red characters represent what data is inserted in the file by the Barcode Test Generator. All data is in hexadecimal to make the files readable since the data represented can be nonprintable asci characters. This empty PEmicro JSON Barcode Test file has been reformatted, spacing wise, to make it more readable. There are many sites on the internet which will reformat JSON files [3].

{
"pesettings": {
  "scannertest": {
    "testchars":"... hex pairs of character test information ... ", 
    "range1":"... hex pairs of range1 lower and upper bounds ... ",
    "range2":"... hex pairs of range2 lower and upper bounds ... "
    },
  "scannersave": {
    "samplechars":"... hex pairs of sample data - not used by Cyclone FX ... ",
    "testcharstrings": "... hex pairs of test data - not used by Cyclone FX ... "
    }
  }
}

The unformatted version of an empty PEmicro JSON Barcode Test file looks like:

{"pesettings":{"scannertest":{"testchars":"","range1":"","range2":""}, "scannersave":{"samplechars":"","testcharstrings":""}}}

The unformatted version of the PEmicro JSON Barcode Test file for the examples used in this manual looks like:

{"pesettings":{"scannertest":{"testchars":"05014343060179790701636308016C6C09016F6F0A 016E6E0B0165650C012D2D0D0146460E01585813013039140130391501303916013039170130 39100241424445","range1":"9330301430359530341630339730369D4142","range2":"943039 9530309630309730309D4445"},"scannersave":{"samplechars":"0150022603450420054306790 763086C096F0A6E0B650C2D0D460E580F201053114E123A13301431153216331734182019521 A651B761C2D1D42","testcharstrings": "0543464303014343067946430301797907 363086C464303016C6C096F464303016F6F0A6E464303016E6E0B654643030165650C2D46430 3012D2D0D464643030146460E5846430301585813304E550307303914314E550307303915324 E550307303916334E550307303917344E55030730391D424D5406024142024445"}}}

Saving a Barcode Test (.bar) File

The current information on the program main screen can be saved to a Barcode Test (.bar) file for two reasons. First, so the tests can be used by PEmicro's Cyclone FX, Standalone programmer. Second, so the information can be loaded back into this program for modification, further testing of the tests themselves, or to assist in the creation of new tests.

To save a Barcode Test (.bar) file, click on the Save File button in the control area of the main screen.

Figure: Program Control Area

Program Control Area

If a filename (editable) exists in the control area, the program tries to save the screen test information to that file. If no filename exists, then the window shown below is opened to search for and/or edit a filename. If Open is clicked, the program attempts to save the test information to that file. On attempting to save a file, the button is recolored respectively on Success or Failure to Save File or Save File.

Figure: Save PEmicro JSON File Window

SaveBarFile

Loading a Barcode Test (.bar) File

PEmicro JSON Barcode Test (.bar) Information can be loaded into this utility so it can be edited further or to test other barcodes.

To load a Barcode Test (.bar) file, click on the Load File button in the control area of the main screen.

Figure: Program Control Area

Program Control Area

If a filename (editable) exists in the control area, the program tries to load test information from that file. If no filename exists, then the window shown below is opened to search for and/or edit a filename. If Open is clicked, the program attempts to load the test information from that file. On attempting to load a file, the button is recolored respectively on Success or Failure to LoadFile.

Figure: Load PEmicro JSON File Window

LoadBarFile

Advanced Program Use

Bulk Copy Option

Often, it is required to make many transfers from Sample characters to Char Test(TYPE): entries or from Char Test(TYPE): entries to Range-1 or Range-2. These transfers are usually done by individually clicking on appropriate down arrows. For large barcodes, this can be very time consuming. With Bulk Copy, Sample characters can be selected / deselected by a mouse entry into a Sample box. Characters which are selected are indicated by changing the font color to red. Once a set of characters has been selected, they are copied into Char Test(TYPE): entries by clicking on the Char Test(TYPE): button. Bulk Copy turns off the selected character red font highlighting.

In a similar manner, Char Test(TYPE): entries can be highlighted and copied into Range-1 or Range-2 entries.

This process takes a little practice to get used to but greatly speeds things up. In addition, this process can be used to copy entries which do not have down arrows assigned to them.

Turning On Bulk Copy

Clicking on the black text Set Bulk Copy button in the program control area enables Bulk Copying. When the Bulk Copy option is selected, the text in the Set Bulk Copy button is recolored red as a reminder to turn the option off by clicking the button again.

Figure: Program Control Area

Program Control Area

Copy Sample Boxes to Char Test

The top figure below shows bulk copy selected Sample characters selected as indicated by the red type fonts. After clicking on the Char Test(TYPE): button the Sample characters are transferred as shown in the lower figure below. Notice that the Sample highlighting is turned off after the copy.

Figure: Highlighted Sample entries for Bulk Copy to Char Test(TYPE): entries

Highlighted_Bulk_Sample_Copy

Figure: After Sample entries Bulk Copy to Char Test(TYPE): entries

After_Bulk_Sample_Copy

Copy Char Test Boxes to a Range

The top figure below shows bulk copy Char Test(TYPE): entries selected as indicated by the red type fonts. After clicking on the Range-1: button the Char Test(TYPE): entries are transferred as shown in the lower figure below. Note that Range-2 entries did not change. However, Char Test(TYPE): can be bulk copied to Range-2 in a similar manner. Notice that the Char Test(TYPE): highlighting is turned off after the copy.

Figure: Highlighted Char Test(TYPE): entries for Bulk Copy to Range entries

Highlighted_Bulk_TypeCopy

Figure: After Char Test(TYPE): entries Bulk Copy to Range-1 entries

After_Bulk_Type_Copy

Turning Off Bulk Copy

Clicking on the red text Set Bulk Copy button in the program control area disables Bulk Copying. When the Bulk Copy option is deselected, the text in the Set Bulk Copy button is recolored to black.

Ctrl-C / Ctrl-V Char Test(TYPE): and Range Copying

This type of copying is used when it is desired to create multiples of the same Char Test(TYPE):, Range-1 or Range-2 entries. Once an entry has been created in a field, it can be designated as the copy entry that field. To designate an entry, place the cursor on the entry and type a Ctrl-C. The background color for that entry will change to yellow to indicate the designation. Note that only entries with light green boxes can be Ctrl-C designated since ASCII entry boxes would simply accept the Ctrl-C character. To designate a different entry, simply redo the designation process on a different entry.

The designated entry in a given field can then be copied into other existing entries in the same field. To accomplish this, place the cursor on an existing entry in the same field. The information in the designated Ctrl-C entry is copied to the cursor location by pressing Ctrl-V. Only cursor entries with light green boxes can be Ctrl-V copied to since ASCII entry boxes would simply accept the Ctrl-V character. After copying, the cursor is automatically moved right circularly to the next available entry box.

Adding Sample Character Spaces

On startup, this utility is configured to allow for up to 36 character spaces. This number was chosen to fit well on most displays. This number can be increased up to 64 characters. To increase the number of display characters, click on the Inc Numb Chars button in the control area of the program.

Figure: Program Control Area

Program Control Area

Each time the Inc Numb Chars button is clicked, an additional character space is added to the display up to a maximum of 64. Also, the width of the program window is increased to accommodate the added character spaces. The number of display characters is only reset to 36 by restarting the utility.

On Screen Graphical Barcode Generator

Sometimes it is convenient to see what a particular Barcode looks like. To instantiate an on screen barcode display, click on the BarCode Gen button in the program control area.

Figure: Program Control Area

Program Control Area

This opens a new window which has an edit box containing "P&E Microcomputer Systems", the graphical barcode for this text, and a button Copy to Sample and DO TEST. Clicking into the edit box allows text to be inserted or edited. Any changes to the edit box are automatically displayed in the graphical barcode which can be scanned. An external target board barcode could be scanned and inserted using a Ctrl-V. The graphical display and the text can be observed to make sure the scanner itself is working correctly.

Figure: Newly opened Barcode Generator Window

BarcodeGenerator

Text from the edit box can then be transferred to the main utility screen Sample characters and tested against the tests being developed by simply clicking on the Copy to Sample and DO TEST button. Any prior Sample characters are deleted before the transfer and testing take place.

When this window option is opened, the text in the BarCode Gen button is colored red as a reminder to turn the window off by clicking the button again.

References

[1] Cyclone Universal and Cyclone Universal FX Manual

[2] The JSON Data Interchange Format

[3] JSON Re-formatter

Adding A Barcode Test Into A Programming Image

Adding the barcode test into an image is done as part of the image creation process. The user should open the Cyclone Image Creation utility and follow the steps to create a programming image. The device should be selected, along with the algorithm, object file, and programming commands. This example uses the commands EM, PM, VM.

The next step is to add the barcode file. In the "FX Special Features" section at the bottom of the utility, the user should check the "Use Barcode File" checkbox and browse for the appropriate created .bar file.

Figure: FX Special Features (Add Barcode File To Image)

image02_crop

After the programming image is stored in the Cyclone FX, it is ready to use. When a barcode is scanned the Cyclone will encounter this programming image, which will prompt it to test for the exact string "P&E MICRO-TEST1" and for the decimal numbers 0 to 500 on the last four characters of the barcode. If the barcode passes this test (and no other programming images on the Cyclone also pass) the image is executed.

Programming Barcode Information Into Memory

The Cyclone has the ability to program a barcode into the memory of certain ARM devices. This feature will program a null-terminated ASCII representation of the Cyclone's last recorded barcode. You can see the last recorded barcode by adding the barcode information to the home screen (see Configure Home Screen for more information).

To program the last recorded barcode, add the "Program Feature Data" command to your programming sequence in the Image Creation Utility and select the "BARCODESTR" feature.

Figure: Program Feature Data

choose_feature

In the next window enter the starting address in which you want the barcode to be recorded (image 2).

Figure: Program Feature Data to Address

prog_to_addr

See Programming Operations for more information on the Program Feature Data command.

Troubleshooting

An error will sometimes be generated if more than one image corresponds to the barcode, or if no images correspond to the barcode. The Cyclone includes a way to quickly gain insight into the issue. A log file is created every time the barcode scanner operates and it details the scanned barcode as well as the analysis process used to select the appropriate programming image.

To access the barcode log, navigate in the Cyclone FX's menu to: Menu->Status->Show Logs->Show Barcode Scanner Log. This Log document contains the details of the last barcode scanner transaction and is overwritten every time the barcode scanner is used.

A sample log file looks like this:

---Scanner Test Log Started---

Scanned barcode: P&E SN: BLUE0138230
5 total number of images in Cyclone

Processing image number 1 (Red Image v1.00)
Image number 1 does not contain a barcode test

Processing image number 2 (Red Image v1.01)
Image number 2 does not contain a barcode test

Processing image number 3 (Widget Rev C)
Image number 3 does not contain a barcode test

Processing image number 4 (Widget Rev D)
Image number 4 does not contain a barcode test

Processing image number 5 (Green Product v7)
Image number 5 passes character test
Image number 5 does not contain a range test
image number 5 passes Barcode Test

One Image passes barcode test
Image number 5 selected to execute

Success, image selected and program command sent

---Scanner Test Log Finished---