© Bueno Systems, Inc. • TSL1401-DB (2009.10.01)
Page 30 of 52
Acquiring an Image
Image acquisition is done using the various acquire commands, each having the same general format:
Acquire
Acquire|XTRIG
They all take no arguments and come in eight flavors, which are described in the table below:
Command
Value
Description
ACQGRAY
$A0
Acquire a binary image, while dumping all 128 grayscale pixel values.
ACQBIN
$A4
Acquire a binary image, replacing the previously-acquired image.
ACQAND
$A1
Acquire a binary image, ANDing the binary pixels with the previous image.
This can be used to track which bright pixels are common to all successive
scans.
ACQOR
$A2
Acquire a binary image, ORing the binary pixels with the previous image.
This can be used to track which bright pixels appear in one or more
successive scans.
ACQXOR
$A3
Acquire a binary image, XORing the binary pixels with the previous image.
This can be used in successive pairs to see which pixels change between
them (useful for motion detection).
ACQORNOT
$A5
Acquire a binary image, ORing the binary pixels with the NOT of the previous
image. This reveals only those pixels that
become
dark betweens pairs of
scans.
ACQANDNOT
$A6
Acquire a binary image, ANDing the binary pixels with the NOT of the
previous image. This reveals only those pixels that
become
bright between
pairs of scans.
ACQXORNOT
$A7
Acquire a binary image, XORing the binary pixels with the NOT of the
previous image. This can be used in successive pairs to see which pixels
remain the same between them.
Two additional constants are defined in the code template:
ACQDIFF
, which is a pseudonym for
ACQXOR
, and
ACQSAME
, which is a pseudonym for
ACQXORNOT
. These pseudonyms reflect the use
of these two commands, which is to find pixels which are either different from, or the same as, pixels
from the previous acquisition.
Although the acquire commands do not take an argument, there is one optional modifier that can be
ORed to it. This is the external trigger constant,
XTRIG
, which has a value of
$08
. When
XTRIG
is
ORed to any acquire command, the command, when executed, will wait for a falling edge on BASIC
Stamp pin
P3
, then begin its exposure. Since
P3
is common to both daughterboard sockets, this same
pin triggers the TSL1401-DB in either one. This enables exposures to be synchronized precisely with an
external event, such as an encoder pulse or optosensor output.
Note
: When the driver firmware is waiting for an external pulse on
P3
, it is not possible to reset it using
the
OWOUT
statement’s reset pulse. However, you can force an exposure by pulling
P3
low momentarily
with the following PBASIC code sequence:
LOW 0 : INPUT 0
Note that
P3
, like
P2
, should not be driven high. The MoBoStamp-pe includes pull-ups for this purpose,
allowing bussed open-collector drivers to actuate it by pulling it down.