Download Print this page

Parallax TSL1401-DB Instructions Manual page 40

Linescan camera module

Advertisement

does
are two: the ">"
shall see in the next section, we can even include an acquisition command in the buffer.
Bagels and Bottles: Putting it All Together
Let's integrate everything we've learned now into a real application. In this application, we've got bagels
passing by single-file atop a black conveyor belt. They are being lighted from above, so they will look
bright against a dark background. We want to record the outer diameter of each one. For this app, we
assume that the bagels are round and not oval. We also assume that there is a wide enough gap
between each pair of bagels that we will see it at least once. Finally, we assume that the conveyor spans
the entire field of view and that there are no crumbs on it to confuse the camera. (In real life, we would
every one
have to question
with all previous examples, we must wrap it in the template given at the end of this chapter to be
complete:
1
lft_edge VAR Byte
2
rgt_edge VAR Byte
3
max_dia
VAR Byte
4
5
OWOUT owio, 1, [SETEXP, 30]
6
OWOUT owio, 0, [SETBIN, 128, 10, FIXED|LEVEL]
7
8
DO
9
OWOUT owio, 0, ["<", ACQBIN, FNDNXT|FWD|BRTEDG]
10
OWOUT owio, 0, [FNDNXT|BKWD|BRTEDG, ">"]
11
GOSUB Ready
12
OWOUT owio, 0, [DUMPADR, RESULTS + 5]
13
OWIN owio, 2, [lft_edge, rgt_edge]
14
IF (rgt_edge) THEN
15
max_dia = rgt_edge - lft_edge + 1 MIN max_dia
16
ELSEIF (max_dia) THEN
17
DEBUG "Bagel diameter: ", DEC max_dia, CR
18
max_dia = 0
19
ENDIF
20
LOOP
Line numbers have been added to the left of the actual program so we can discuss each line here:
© Bueno Systems, Inc. • TSL1401-DB (2009.10.01)
get buffered. That's five altogether, so we're well within the eleven limit. As we
of these assumptions!) Here is the meat of the code that will do the work. As
Page 40 of 52

Advertisement

loading