0% found this document useful (0 votes)
117 views

Sherlock Embedded Tutorial - v13

Uploaded by

Ferenc Sulics
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
117 views

Sherlock Embedded Tutorial - v13

Uploaded by

Ferenc Sulics
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 36

Sherlock Embedded Tutorial

This tutorial requires:

a BOA PRO with an IP Address compatible with the PC, and the Sherlock Embedded software running.
a PC with the Sherlock Embedded Client software installed (see the installation manual for instructions).
a BOA Breakout board with the I/O cable attached (see the installation manual for instructions).

Start the Sherlock Embedded Client


From the Windows® Start menu, select: Programs – Teledyne DALSA – Sherlock Embedded – Sherlock
Embedded. If this is the first time you are connecting with this PC, you may get a popup message about the IP
Address. The displayed address should match your PC. Click “OK”.

The “Connect” window opens.

If this is the first time you are connecting to the BOA


with this PC, the “Remote address” may display the
Factory default address: 192.168.0.100.

All BOA cameras running Sherlock Embedded on this


network neighborhood will be listed in the Address
field. Units that are not at compatible addresses will
not appear.

The Address field should show an IP Address and


port number, the BOA running status, and software
version. In this example; the address is 10.5.1.85,
the port is 4500, the status is “Free, halted” and the
firmware is 1.0.1.360 (for version 1.0.1 build 360).

Click on the BOA IP Address in the Address field,


and that address appears in the “Remote address”
field. If this BOA is password protected, enter the
password.

If the address is grayed out, and is not highlighted


when you click on it, the software version on the
BOA is not compatible with the version on the PC.
You can open the Emulator, to find the version
installed on the PC.

405-00032-00 edited 25 January 2013 page 1 of 36


Sherlock Embedded Tutorial

Click the “Connect” button. The connect window closes

A small popup opens, displaying some loading messages.


This window closes, and the Sherlock Embedded client
application opens.

You can use the iDiscover utility (in Sherlock Embedded\Utility) to find and change the IP Address of your BOA
PRO camera. But do not use iDiscover to connect to the camera. Refer to the BOA Pro Installation Manual.

Rearrange the Windows


The layout of the Client Application should appear similar to the figure below. If it does not, close the extra
windows. (The alternative is all the Sherlock Embedded windows or “views” are open.)

405-00032-00 edited 25 January 2013 page 2 of 36


Sherlock Embedded Tutorial

You can use the Windows® “Close” control in the top right corner of each
window, or you can use the View menu in the Main Window’s menu bar. A
check to the left of a window name indicates the window is open. The absence
of a check indicates the window is closed. Click on a window name to toggle
between open and closed.

To duplicate the layout in the Figure, close the “Digital IO Monitor”,


“Instructions”, “Watch” windows. You should have the “System”, “Program”,
“Properties”, “Monitor”, and “Configuration” windows open.

If you maximize the Image Window, the controls will appear at the far right of the Main Window’s menu bar.

You can drag and drop windows onto each other. Tabs will appear at the bottom of the stacked windows.

Drag and drop the Configuration Window onto the Monitor Window. Drag and drop the Program Window onto
the Properties Window. Click the Properties tab. Drag and drop the Properties Window beside the Configuration
Window. Resize windows to your liking.

Your window layout is saved to a file “layout.ini” when you close the Sherlock Embedded Client Application
Program. You can save a copy of the layout file to another directory so you can restore it, or so it is not lost
when you uninstall the Client application before upgrading to a newer version.

In the Main Window menu bar, click on “Options” and click on “Application settings”. The first entry
“Application->Gui Style” defines the windows style used in the Client Application, for this client PC.

Click once on the entry in the “Value” column to activate the drop list. Click a second time to open the drop list
and show the styles available. Change the style if you wish, and click “Close”.

Scroll down to find “Angle unit of measure”. Select either Radians or Degrees before you begin programming.
The Sherlock Embedded software does not convert from one unit to the other automatically. Do not save
programs in one unit of measure and later change the unit of measure. The software does not convert numbers
for you when loading a saved program.

405-00032-00 edited 25 January 2013 page 3 of 36


Sherlock Embedded Tutorial

Start a New Program


In the Main Window’s menu bar, click on “Program” and select “New”. Or, click the “Create new program”
button in the Main Window toolbar.

A new or default program will have three tabs at the bottom of the Program Window, for the “main” routine
and two subroutines, named “onPass” and “onFail”.

The default program contains an image acquisition instruction (acqA) and an Image Window instruction
(image_windowA) in the routine. NOTE: The image handle from the acqA instruction is connected to the image
handle in the image_windowA instruction.

The letter A is appended to your instructions to indicate the first instance of each instruction. A letter is always
appended because these instructions can be repeated in a program. You can change the names of instructions in
the Properties Window to suit your needs.

Under the image_windowA instruction, the image handle “Hdl


image” is connected to the acquire instruction’s image output
handle acqA.image. The “Hdl” indicates the object “Type” is a
“handle”.

“Hdl” is red under the acqA instruction because the image is an


output. “Hdl” is green under the image_windowA instruction
because the image is an input.

IMPORTANT!
If you create an Image Window, you must connect the
image input (handle) to some image source; usually a
camera acquisition.

You can do this by right-clicking on the image handle. The


popup menu will display all available image sources.

You can also make this connection by dragging the output


“Hdl image” under the “acqA” instruction, and dropping it
onto the input “Hdl image” under the “image_windowA”
instruction.

Focus the Camera


Click the green “Live image start” button at the top of the Image Window, to display a live
image for focusing your camera. Click the red “Live image stop” button when done.

405-00032-00 edited 25 January 2013 page 4 of 36


Sherlock Embedded Tutorial

Explore the Properties Window

Click on “cam0” in the System Window.

The Properties Window shows the camera


properties.

The first section is titled “Properties”


followed by several entries. The name
“cam0” cannot be changed. Other entries
can be edited.

Click on “full resolution” beside “partial


scan”. Click a second time, and a list of
values appears.

Click on “internal (0)” beside “trigger”.


Click a second time to open the drop list.

You would use this field to select an


external trigger for your BOA smart
camera.

Beside “trigger_freq” click on the “10”.


Two controls appear in the field. A
“number wheel” and a “slider”. You
can use either control to change the value
for internal trigger frequency.

405-00032-00 edited 25 January 2013 page 5 of 36


Sherlock Embedded Tutorial

Scroll down to the bottom of the Properties


Window. The “Outputs” section shows the
camera image width and height.

Notice the “Type” column shows different


colors for the Properties and the Outputs.
Properties types are blue and Outputs types
are red.

Click in the Value field beside “width” There


are two controls at the right of this field.

The number wheel is grayed out, but the second control on the right is active. It currently shows a entry field
icon . Click on this icon and it changes to two chain links , for linking the value to a variable. Now click on
the Value field to open a drop list of the defined variables that could be attached to this value. At this time there
are no available variables. Click on “<none>” to close the list. Click once on the link icon to change it back to
an entry field and the value 640.00 is again displayed.

In the Program Window, notice under “acqA” the type “S”


beside “cam” is green. Under “image_windowA” the
type”Hdl” is also green. These are Inputs. All the other types
under the “acqA” are red. These are outputs. The Program
Window is displaying the inputs and outputs of the
instructions “acqA” and “image_windowA”.

405-00032-00 edited 25 January 2013 page 6 of 36


Sherlock Embedded Tutorial

In the Program Window, click on the


instruction “acqA”. The Properties
Window changes to show the properties of
the acquisition instruction “acqA”.

There are Properties: “name”, “enabled”,


and “time”. There is one Input: “cam”, and
four Outputs: “image”, “arrival_time”,
“image_number”, and “status”. The
Properties Window also shows the values
of the inputs and outputs. The Program
Window does not show the values.

In the Program Window, click on the instruction “image_windowA”. The Properties Window changes to show
the Image Window properties.

The Image Window has Properties: “name”, “enabled”, “time” and “calibration”. The Image Window has one
Input: “image”. The Properties Window show the input of the Image Window is connected to “acqA.image”.
The Program Window also shows this connection: Hdl image<-acqA.image.

Notice that all instructions have a property “enabled”. You can disable any instruction for debugging purposes.

Create an ROI
“ROI” stands for “Region Of Interest”.

In the Image Window toolbar, click on the “Create Rectangle” button . Click on the image to define the
starting point of the rectangle. Move your cursor and click a second time to define the ending point of the
rectangle. A label “rectangleA” appears at the top of the rectangle (in red).

405-00032-00 edited 25 January 2013 page 7 of 36


Sherlock Embedded Tutorial

In the Program Window, the instruction “rectangleA” appears


under the “image_windowA” instruction. The rectangle
instruction is a “child” of the Image Window instruction. The
rectangle instruction has one input and one output.

The Configuration Window also changes. This will be discussed


later.

405-00032-00 edited 25 January 2013 page 8 of 36


Sherlock Embedded Tutorial

Right-click inside the rectangle to view a popup menu. Move your


cursor over “Algorithms” and in the second menu, click on
“min_max”.

In this menu you can also copy or delete the ROI. If you Copy, an
option to Paste will also appear in this menu. When you copy and
paste an ROI, the new ROI appears on top of the original, at the
same location. Drag the new ROI to a new location.

If you right-click in the image window, outside the ROI, you get a
popup menu for colorizing the image.

Algorithms and preprocessors you create by right-clicking in the ROI in the Image Window are added or
appended in the order you create them.
Algorithms or preprocessors you create by right-clicking on the ROI instruction in the Program Window are
added right below the ROI instruction.
You can drag and drop algorithms and preprocessors to arrange them, with no restrictions on the order.

The “min_maxA” instruction appears in the Program Window, as a


child of the “rectangleA” instruction. The min_max instruction has
four outputs, and no inputs. This Algorithm identifies the maximum
and minimum pixel intensities and their point positions.

The locations of the minimum and maximum points are displayed in


blue in the Image Window. Depending on your image content, only
one point may be displayed (if all pixels are 255, only the maximum
point is displayed).

You can drag the point readings to a new location (for example,
outside the ROI). You can also hide the readings, by right-clicking on
the point and clearing the check beside “Display in image” in the
popup.

The “Create instruction and connect” option allows you to create an


instruction that takes a point as an input.

The “Connect as input to” option allows you to connect to an


instruction already created in your program window.

405-00032-00 edited 25 January 2013 page 9 of 36


Sherlock Embedded Tutorial

In the Program Window, right-click on


“min_maxA” to open the Instructions
popup menu. Move your cursor to
“Number” and in the second menu click on
“square_root_number”.

The instruction “square_root_numberA”


appears under the “min_maxA” instruction.

If you right-click on an ROI instruction, like


rectangleA, the Algorithms and
Preprocessors also appear in the
instructions popup menu.

You can copy and delete instructions using


the popup menu. If you copy, the options to
“Paste” and “Paste single instruction” will
appear.

Create Variables
In the System Window, click on “Variables”.
A toolbar appears in the System widow.
The buttons display the variable data types
available: B = Boolean, N = Number, S =
String, P = Point, L = Line, B[] = Boolean
array, N[] = Number array, S[] = String
array, P[] = Point array, L[] = Line array.

There are other data types supported by Sherlock Embedded, but you cannot create variables for those types;
for example Hdl = Handle.

Click on the “N” button twice to create two


Number variables. The variables appear in
the left and right-panes of the System
Window: “varA” and “varB”. The left pane
shows their types. The right pane shows
their current values.

The System Window is the only place you can create and delete variables.
405-00032-00 edited 25 January 2013 page 10 of 36
Sherlock Embedded Tutorial

Assign Variables

Under “min_maxA” right-click on “N max”.


Move your cursor over the “Connect”
popup. The second level menu shows the
available number variables. Click on
“varA.value”.

The maximum pixel value is now assigned


to variable

IMPORTANT! “varA” is the variable name. “varA.value” is the current value (0.00) of the variable.

Now right-click on “P max_pos” and move your cursor onto


the “Connect” popup. There is no second level popup,
because there are no variables or numbers of type “Point”
available.

Notice the “Display in image window” control. You can


clear the checkbox to hide the Point coordinates display
(blue) in the Image Window. If you have already hidden
this Point, you can use this control to display it again.

In the Program Window, click on the instruction “square_root_numberA”.

The Properties Window displays the


Properties for the instruction. In the
“Inputs” section, click in the value field
containing 0.00. The field becomes
active, with two controls at the right.

The first control is a number wheel


you can use to increase the number
value. The second control shows an icon
of an field entry .

405-00032-00 edited 25 January 2013 page 11 of 36


Sherlock Embedded Tutorial

Click once on the field entry control. The


icon changes to chain links , and the
number field changes to a drop list
showing the value “<none>”.

Click in the field and a list of all the


available Number variables and Number
values appears. Click on “varA.value”.

In the Properties Window, under the


“Outputs” section click on the value 0.00
beside “N square_root”. Click on the field
entry control so the icon changes
and the number field becomes a drop
list. Click on “<none>” and select
“varB.value”.

Notice that the list is shorter for the output than it was for the input. There are more numbers and variables
available to assign to an input, but fewer numbers or variables that can accept an output value (or “reading”).

Click on the gray divider labeled “Outputs” or press “Enter” or “Return” on your keyboard, to accept this change.

The Program Window now shows the


variable assignments you have made. The
Properties Window does not show all these
connections or assignments, but shows the
current values of the inputs and outputs.

405-00032-00 edited 25 January 2013 page 12 of 36


Sherlock Embedded Tutorial

Run the Program


In the Main Window toolbar, click the “Run
program once” button. Notice the values of
varA and varB are displayed in the right
pane of the System Window (if Variables is
still highlighted).

Save the First Tutorial Program

In the Main Window toolbar, click the “Save program


file” button, or in the menu bar click “Program” and click
on “Save”.

In the lower half of the Save program window, select


Index 0, enter the name “Tutorial1” and enter a
description “Simple program. Click “OK”.

The index supports numbers from 0 to 99. The actual


number of programs you can save depends on how
complex your programs are. Calibration, OCR trained
characters, Search patterns (or “models”) add
complexity and increase the program size.

405-00032-00 edited 25 January 2013 page 13 of 36


Sherlock Embedded Tutorial

Create a Test Condition

Click on “rectangle” in the Program Window.

Scroll down to the bottom of the Property


Window.

Click in the “value” column beside


“enable_pass_fail”.

Check the box to change the value to “true”.

The Configuration Window shows three tabs at the top. Click on the “Pass/Fail script” tab. This tab has two
panes for a code statement and properties. Note this code entry window is case sensitive. The right pane
displays all the defined object names.

If you have closed the Configuration Window it will not automatically open on its own when you select an object
that uses the Configuration Window. If the Configuration Window is open and behind another tab, it will come
to the front.

405-00032-00 edited 25 January 2013 page 14 of 36


Sherlock Embedded Tutorial

In the left pane of the Configuration Window, delete


the word “true”.

Type VEn and a popup opens to display the word


“VEngine”. Press Enter to accept this value. The Code
entry window is case sensitive. If you type ven the
popup will appear, but selecting it will not correct your
capitalization.

“VEngine” is a special variable that links the Sherlock program environment to the JavaScript environment. But
“vengine” is not a special variable.

Now type a period after “VEngine”. A popup appears


showing names or variables. Scroll down and click on
“varA”.

Type a period after “VEngine.varA” and a popup


appears, with the entry: “value”. Press Enter to accept
this entry.

Now type a space, type the right carret “>” and a


space, and type 150. The code pane should now
contain a statement “VEngine.varA.value > 150”.

You can drag values from the right pane into the left pane. The right pane displays the names and values of all
objects and variables; defined by you and by Sherlock instructions. For this statement you could scroll through
the right pane to find “VEngine.varA.value”. You could also find “VEngine.min_max.max” and use that
measurement directly, without using the variable value “varA.value”.

405-00032-00 edited 25 January 2013 page 15 of 36


Sherlock Embedded Tutorial

Click the “Check Syntax” button. No messages should


appear in the lower field.

Click the “Evaluate” button. A message should appear


saying either “Script returns ‘true’ ” or “Script returns
‘false’ ”.

The message depends on the maximum pixel intensity


in your rectangle ROI being greater or less than 150.

Click the “Save” button. The code will not be saved or used in the program if you do not click “Save”.

In the Image Window, the rectangle outline will change to red if the test fails (script statement evaluates
“false”), and change to green if the test passes (script statement evaluates “true”).

Create a Pass/Fail Condition


In the System Window, click on “system”. The Properties Window changes to show the system properties. The
Configuration Window changes to show the “Decision Table”. Notice there is no default statement. The
numbers at the bottom (Runs 2 and Pass 2) are data from the previous executions of the program.

Click the “Add” button to open a list of all available variables and properties. Click on “rectangleA.pass [B]”. The
[B] indicates this object is a Boolean.

405-00032-00 edited 25 January 2013 page 16 of 36


Sherlock Embedded Tutorial

In the Decision Table, click on the property name “rectangleA.pass” and then click in the checkbox to enable this
property for the composite Pass/Fail result.

The checkbox allows you to disable an object from the composite result, without deleting it from the table.

Now click the “Reset” button at the bottom of the panel. All values are reset to zero. In the Properties Window,
the values for “pass” and “pass_fail_history” are also set to zero.

At the end of the Main routine, if the rectangle test condition passes, this property evaluates “true” and the
result of the Decision Table is a pass. The main routine calls the “onPass” subroutine. If the result of the Decision
Table is a fail, the main routine calls the “onFail” subroutine.

405-00032-00 edited 25 January 2013 page 17 of 36


Sherlock Embedded Tutorial

The result of the Decision Table is referred to as the “composite result” because you can add multiple variables
or objects to the Decision Table. The composite result passes only if all enabled objects pass. The composite
result fails if one or more enable objects fail.

In the Status bar, there will be an indication of “Pass” and “Fail” based on the
Decision Table passing or failing.

Alternatively, you could use the maximum value from the min_maxA measurement directly, instead of the ROI
pass condition. Or you could use the value of variable varA, which is also the maximum value.

Click on the value “true” in the Expected


value column and click a second time to
change the acceptance range on a number
value, or to change the passing value of a
Boolean.

Numbers allow you to set a minimum and


maximum value.

You can also link the values to variables or


objects using the buttons to the right of the
number fields.

405-00032-00 edited 25 January 2013 page 18 of 36


Sherlock Embedded Tutorial

Count the Number of Passed and Failed Parts

In the System Window, click on


“Variables”. Create two more Number
variables using the “N” button.

Click on “varC” in the right pane of the


System Window. In the Properties
Window, click on “varC”

and change it to NumberPassed, and


press Enter.

NOTE: Spaces are not allowed in variable


names. All object names must comply
with the JavaScript conventions.

The right pane of the System Window


updates with the new variable name.

In the System Window left pane,


click on “varD”. In the Properties
Window, click on “varD” and change
it to NumberFailed.

Press Enter and the right pane of the


System Window updates with the
new variable name.

405-00032-00 edited 25 January 2013 page 19 of 36


Sherlock Embedded Tutorial

In the Program Window, click on the “onPass”


tab. Right-click on the statement “onPass” in
the Program Window. In the Instruction popup
move your cursor to Number and click on
“add_number”.

The instruction “add_numberA” is added to the Program


Window.

Click on the instruction “add_numberA” in the Program


Window.

In the Properties Window, in the Inputs


section, click on the first 0.00 beside
“Number”.

Change the value to 1.

Click on the 0.00 beside “[add number]”.

Click on the entry field button to


change the icon to link and change
the number field to a drop list.

405-00032-00 edited 25 January 2013 page 20 of 36


Sherlock Embedded Tutorial

Click in the drop list and click on


“NumberPassed.value”.

In the Properties Window, another


number input appears. “number1” is
assigned your variable, and “[add
number]” appears below it. This is called
an “infinite entry” instruction. You can
keep adding more numbers.

In the Properties Window, scroll down to see


the Outputs section.

Click on the 0.00 beside “sum”. Click on the


right control button to change the icon and
change the number field to a drop list.

Click on the drop list and click on


“NumberPassed.value”.

The Program Window updates to show the variable


connections to the instructions.

In the Program Window, click on the “onFail” tab. Right-click on the statement “onFail” in the Program Window.
In the Instruction popup move your cursor to Number and click on “add_number”.

The instruction “add_numberB” is added to the Program Window.

Click on the instruction “add_numberB” in the Program Window.

405-00032-00 edited 25 January 2013 page 21 of 36


Sherlock Embedded Tutorial

In the Properties Window, in the Inputs


section, click on the first 0.00 beside
“Number”. Change the value to 1. Click on
the 0.00 beside “[add number]”. Click on
the right control button to change the icon
and change the number field to a drop list.
Click in the drop list and click on
“NumberFailed.value”.

In the System menu, click on “Number


Failed” in the right pane,

and drag and drop it onto “N sum” in the


Program Window. The Program Window
updates to show the variable connections
to the instructions.

The Properties Window changes to show the value contained in “sum” is still zero. This matches the value in the
right pane of the System Window, beside the variable name “Number Failed”.

Note: If you make an error assigning a variable, or need to


change program, you can right-click on the assignment in the
Program Window, and select “Disconnect” in the popup.

Sherlock Embedded has System variables that track the number of passed and failed parts, but this exercise
shows how to assign variables, change variable names and increment numbers. All these are frequently used.

405-00032-00 edited 25 January 2013 page 22 of 36


Sherlock Embedded Tutorial

Add a Message
In the Program Window, click on the “onPass” tab.
Right click on the “add_numberA” instruction. In
the Instruction menu move your cursor to
IO:Monitor and in the second menu click on
“display_message”. The instruction
“display_messageA” appears in the Program
Window.

In the Program Window, click on the


instruction “display_messageA”. In the
Properties Window, click on the field in
the Value column, beside “message”.

Delete “hello”, type Passed and press


Enter.

In the Program Window, click on the “onFail” tab. Right click


on the “add_numberB” instruction. In the Instruction menu
move your cursor to IO:Monitor and in the second menu click
on “display_message”. The instruction “display_messageB”
appears in the Program Window.

405-00032-00 edited 25 January 2013 page 23 of 36


Sherlock Embedded Tutorial

In the Program Window, click on the


instruction “display_messageB”. In the
Properties Window, click on the field in the
Value column, beside “message”. Delete
“hello”, type Failed and press Enter.

Run the Program


Click on the “Monitor” tab under the Configuration Window.

In the Main Window Toolbar, click the “Run program once” button.

The Monitor Window should show a message


“Passed” or “Failed” depending on the pixel
intensities in your rectangle ROI.

You can move or resize the rectangle to change


the value and change the message. Click the
“Run program once” to see the message change.

You can clear the Monitor Window messages at any time, by right-clicking in the Monitor Window.

In the System Window, click on “System”. The Configuration Window should display over the Monitor Window,
and show the Decision Table.

Save the Second Tutorial Program

In the System Window, click on “varA”. In


the Properties Window, click on the
number value beside “value” and change it
to 0.

Repeat this for all four variables, so all


values are 0.

In the Main Window Toolbar, click the


“Save As” button.

405-00032-00 edited 25 January 2013 page 24 of 36


Sherlock Embedded Tutorial

In the Save program window, change the Index to 1. Enter Tutorial2 in the Name field and enter Add messages
in the Description field. Click on “OK” to save the program in BOA memory.

We changed all variables to 0 before saving, so you do not see outdated values when you reload the program.
You can also clear the variables in a routine “onEvent_program_loaded” that runs when you load the program.

Add Digital Output


This step requires you have a BOA breakout board attached to your BOA.

Click on the “onPass” tab at the bottom of the Program


Window. In the Program Window, right click on the
instruction “display_messageA”. Move your cursor to
“IO:Digital”. In the second menu click on “set_dig_io”.

The instruction “set_dig_ioA” appears in the Program


Window.

Right-click on “set_dig_ioA” and move to “IO:Digital”.


Click on “async_pulse_dig_io”.

pulse_dig_io – Sherlock sends the pulse command to the hardware, and waits for the pulse to complete. This
makes the program execution wait at least the pulse duration time before going to the next statement.

async_pulse_dig_io – Sherlock sends the pulse command to the hardware, and continues to the next statement
without waiting. The pulse begins almost immediately, with minimum wait time.

schedule_async_pulse_dig_io – Sherlock sends the pulse command to the hardware, and continues to the next
statement without waiting. The pulse delay count begins almost immediately.

set_dig_io – Sherlock sends a command to the hardware and continues to the next statement without waiting.

405-00032-00 edited 25 January 2013 page 25 of 36


Sherlock Embedded Tutorial

The instruction “async_pulse_dig_ioA” appears in the


Program Window.

In the Program Window, click on “set_dig_ioA”.

In the Properties Window, verify the “channel” value is 0.

Click on the value “true” beside the Property “state”.

Clear the checkbox, and the value changes to “false”. Press Enter.

Output 0 is set to 0 by this instruction.

In the Program Window, click on the instruction


“async_pulse_dig_ioA”. In the Properties Window, change the
value of “channel” to 1. Verify the Pulse time is 20 and the state
is true.

Output 1 is pulsed high for 20 milliseconds by this instruction.

405-00032-00 edited 25 January 2013 page 26 of 36


Sherlock Embedded Tutorial

Click on the “onFail” tab at the bottom of the Program Window.


In the Program Window right click on the instruction
“display_messageB”. Move your cursor to “IO:Digital”. In the
second menu click on “set_dig_io”.

The instruction “set_dig_ioB” appears in the Program Window.

Right-click on “set_dig_ioB” and move to “IO:Digital” in the


Instruction menu. Click on “async_pulse_dig_io”.

The instruction “async_pulse_dig_ioB” appears in the Program


Window.

In the Program Window, click on “set_dig_ioB”.

In the Properties Window, change the


“channel” value to 1. Click on the entry
“true” beside “state”. Clear the checkbox,
and the value changes to “false”. Press
Enter.

Output 1 is set to 0 by this instruction.

In the Program Window, click on the


instruction “async_pulse_dig_ioB”.

In the Properties Window, verify the value


beside “channel” is 0, the pulse time is 20
and the state is “true”.

Output 0 is pulsed high for 20 milliseconds


by this instruction.

Run the Program


In the Image Window, move the rectangle ROI to a place that does contain some white or bright pixels, so the
program passes. In the Main Window toolbar, click the “Run program continuously” button . Observe the
LEDs on the breakout board. The LED for Out1 should be blinking, and the LED for Out0 should be off. Notice
also, in the Image Window, the rectangle outline is green (pass).

In the Main Window toolbar, click the Stop button. In the Image Window, move the ROI to an area that does not
contain any bright pixels, so the program fails. In the Main Window toolbar, click the “Run program

405-00032-00 edited 25 January 2013 page 27 of 36


Sherlock Embedded Tutorial

continuously” button. Observe the LEDs on the breakout board again. The LED for Out0 should be blinking, and
the LED for Out1 should be off. Notice also, in the Image Window the rectangle outline is red (fail).

In the System Window, click on Digital Input 0. The Configuration Window changes to an interactive way to
monitor the inputs. In the System Window, click on Digital Output 0. The Configuration Window changes to an
interactive way to monitor or set the outputs.

Add a Stop Condition


Because we used the pulse instruction, the digital outputs are all off when the program is stopped. If you set the
output high (using set_dig_io) instead of pulsing it, you should consider how to handle the output when you halt
the program. Do you want the output to remain set at the last value, or clear it? You can use the Event handlers
onEvent_program_abort or onEvent_program_stop to set outputs to specific conditions.

In this step, we create a routine that runs when the program is stopped, and sets both outputs to zero.

Right-click in the Program Window, move down to Event


Handlers, and click on “onEvent_program_stop”.

In the Program Window, right-click on


“onEvent_program_stopA”, move the cursor down to
“IO:Digital” and click on “set_dig_io”.

In the Program window, right-click on “set_dig_ioC”. Move


your cursor down to “IO:Digtal” and click on “set_dig_io”.

In the Program Window, click on “set_dig_ioC”. In the


Properties window, verify the “channel” is 0, and change the
“state” to false.

405-00032-00 edited 25 January 2013 page 28 of 36


Sherlock Embedded Tutorial

In the Program Window, click on “set_dig_ioD”. In the


Properties window, change the “channel” to 1, and change
the “state” to false.

You can use onEvent_program_stop to set or clear IO and values, or finalize communications with peripheral
devices such as a PLC.

Save the Third Tutorial Program


In the Main Window Toolbar, click the “Save As” button.

In the Save program window, change the Index to 2. Enter Tutorial3 in the Name field and enter Add Digital IO
in the Description field. Click on “OK” to save the program in BOA memory.

Add Initial Conditions


The onEvent_program_loaded routine can set initial states for variables, digital outputs, or initialize
communication with peripheral devices. There is also an event for when the program is run.

Right-click in the Program Window, move the cursor


down to “Event Handlers” and click on
“onEvent_program_loaded”.

405-00032-00 edited 25 January 2013 page 29 of 36


Sherlock Embedded Tutorial

In the Program Window, right-click on “onEvent_program_loadedA”,


move the cursor to “IO:Digital” and click on “set_dig_io”. Right-click on
“set_dig_ioE” and click on “Copy”. Right-click on “set_dig_ioE” again
and click on Paste.

In the Program Window, right-click on “set_dig_ioF”, move down to


“Number”, and click “set_number”. In the Program Window, right-click
on “set_numberA”, and click on “Copy”. Right-click on “set_numberA”
again, and click on “Paste”.

Repeat the Paste two more times, so you have four “set_number”
instructions.

In the Program Window, click on “set_dig_ioE”. In the


Properties Window, verify the “channel” is 0. Change the
“state” to false.

In the Program Window, click on “set_dig_ioF”. In the


Properties Window, change the “channel” to 1 and change the
“state” to false.

In the System Window, click on Variables.

Drag “varA” into the Program Window and drop it onto the “result”
output for instruction “set_numberA”.

Drag “varB” and drop it onto the “result” output for instruction
“set_numberB”.

Drag “NumberPassed” onto the “result” output of “set_numberC”.

Drag “NumberFailed” onto the “result” output of “set_numberD”.

Now all the variables are cleared when the program is loaded. You do
not have to clear the values before saving the program.

405-00032-00 edited 25 January 2013 page 30 of 36


Sherlock Embedded Tutorial

Expand Values
At the bottom of the Program Window, click on the “onPass” tab.

In the Program Window, right-click on “add_numberA”.

In the Instruction menu move your cursor to String and click on


“expand_values” in the second menu.

In the Program Window, click on the instruction “expand_valuesA”.

In the Properties Window, click in the


blank field beside “source”. Type in
Passed! Count =
[NumberPassed.value.0].

There is no intellisense in this field.


You must be careful to type the
variable name correctly!

The variable value inside the square brackets gets evaluated or expanded into its number value in the string
result. The 0 forces no decimal point. You can specify any number of decimal places (display precision). If you do
not specify a number, the default precision is 2.

In the Program Window, under the instruction


“expand_valuesA” click on “S result” and drag and drop it onto
“S message” under the instruction “display_messageA”.

This overwrites the string “Passed” you previously typed into


the field.

At the bottom of the Program Window, click on the “onFail” tab. In the Program Window right-click on
“add_numberB”. In the Instruction menu move your cursor to String and click on “expand_values” in the second
menu.

405-00032-00 edited 25 January 2013 page 31 of 36


Sherlock Embedded Tutorial

In the Program Window, click on the instruction


“expand_valuesB”.

In the Properties Window, click in the blank field


beside “source”. Type in Failed! Count =
[NumberFailed.value.0].

You must type the variable name exactly as it


appears in the System Window.

Note: You can also click on the “Advanced edit” button to open a
“String edit” window.

This window is resizable, and allows you to more easily enter longer
strings than the one in this example.

In the Program Window, under the instruction


“expand_valuesB” click on “S result” and drag and drop it
onto “S message” under the instruction
“display_messageB”.

Click the “Run program once” button a couple


times.

You should see your message in the Monitor


Window now contains a number that is increasing
by one each time you press the “Run program
once” button.

You can clear the Monitor Window messages at any time, by right-clicking in the Monitor Window.

405-00032-00 edited 25 January 2013 page 32 of 36


Sherlock Embedded Tutorial

Add the Watch Window

In the Main Window menu bar, click on “View” and click on “watch”.

The Watch Window may appear as a tab at the bottom of the Properties
Window, and may be behind the Properties Window. If it is, click on the
tab to bring it in front. If the Watch Window appears somewhere else,
drag and drop the Watch Window onto the Properties Window.

In the System Window, click on Variables. In the right pane


click on “Number Passed” and drag and drop it in the Watch
Window. Click on “Number Failed” and drag and drop it in
the Watch Window. Adjust the width of columns to your
satisfaction.

You can drag any variable from the System Window into the Watch Window. You cannot drag variables, strings,
or numbers from the Program Window into the Watch Window.

When you deploy your program to your test group, you may wish to leave the Watch Window open and close
the Properties Window and other windows for a cleaner or simplified look.

The window layout is saved in a separate file. It is not saved in the program file. If the Watch Window is closed
by a user, loading or running this program will not automatically open the Watch Window.

Save the fourth Tutorial program


In the Main Window toolbar, click the “Save As” button.

In the Save program window, change the Index to 3. Enter Tutorial4 in the Name field and enter Initialize,
Expand Strings and Watch Window in the Description field. Click on “OK” to save the program in BOA memory.

405-00032-00 edited 25 January 2013 page 33 of 36


Sherlock Embedded Tutorial

Load a Program
In the Main Window, click the “Open program file” button, or use the menu bar.

The “Load program” window opens. The “Load programs” window allows you to select a program saved to the
BOA storage memory, and load it to the active program memory, so it can be run.

In the “Load program” window your four Tutorial


programs are listed in the Saved programs field.

Click on a program to populate the fields in the bottom


half of the window.

Click “OK” to load that program into active memory on


the BOA, and run the program.

The index supports numbers from 0 to 99. The actual


number of programs you can save depends on how
complex your programs are. Calibration, OCR trained
characters, Search patterns or models all complexity
and size to the program.

If you load Tutorial4, you can see that the numbers in the Watch Window are reset to zero. And if you click on
“Variables” in the System Window, you can see that the variables are also reset to zero. This shows that the
onEvent_program_load routine is working correctly to initialize all values.

405-00032-00 edited 25 January 2013 page 34 of 36


Sherlock Embedded Tutorial

Export Programs
In the Main Window click on “Program” in the menu bar. Click on “Export”.

The “Export programs” window allows you to save one or all programs stored in the BOA’s memory to your PC.
You can use this to copy programs to a second BOA, or archive your programs.

You can click on individual


programs, or use the “Select all”
button.

Notice the bottom of this window


shows the destination directory.
You can use the “Browse” button
to change the directory location
where programs are saved.

Subdirectories are created in the


Target directory. The directory
names are the index numbers (0,
1, 2, 3). The program files are
saved in these subdirectories.

By default the Overwrite option is


not selected. If you leave this box
unchecked, numbers will be
changed each time you export the
same program, to unused index
numbers. Make sure you use the
name and description, so you can
identify duplicated programs at
different indexes.

The default export location is shown above the OK and Cancel buttons. Use the Browse button to change the
location. The Client/Emulator will remember the new location for future Export and Import operations.

The default location uses a Windows environment variable for user application data. This translates to a
different location under Windows XP and Windows 7.

405-00032-00 edited 25 January 2013 page 35 of 36


Sherlock Embedded Tutorial

Import Programs
In the Main Window click on “Program” in the menu bar. Click on “Import”.

The “Import programs” window allows you to import Sherlock Embedded programs stored on the Client PC, into
the storage memory on the BOA smart camera.

The “Import programs” window


has a “Browse” button at the top,
so you can browse to the
directory (Target directory in the
Export window) that contains the
subdirectories for your programs.
(Index numbers.)

Click “OK” in the “Browse for


Folder” window, and the
Programs should be listed in the
“Programs to import” field, as
shown here.

You can check individual


programs, or use the “Select all”
button.

The index supports numbers 0


through 99. Larger numbers
cannot be imported.

NOTE: You cannot change the index numbers as you import programs.

You can change the index numbers before you import, by using Windows® Explorer to change the subdirectory
name/number. This will change the index number in the Import window, and in the BOA Pro program memory.

405-00032-00 edited 25 January 2013 page 36 of 36

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy