Download Print this page

Parallax TSL1401-DB Instructions Manual page 46

Linescan camera module

Advertisement

difference between the desired and actual levels to get a faster response. For example, the auto-
exposure method used in the TSL1401 Monitor program is:
exp = $E000 / (maxbrt / $FF + 1 * maxbrt) */ exp max 255 min 1
where exp is the exposure time, and maxbrt is the maximum brightness read from location MAXPIX
after each acquisition. This method responds instantly to changes in maximum brightness, which may not
always be a good thing – especially when those changes occur because of changes in the subject and not
changes in the lighting. But this just illustrates that there are many possible approaches and that you
have to pick one appropriate to your individual application.
PBASIC Code Template
Here is the code template, TSL1401_template.bpe, which defines all the constants and subroutines
used by the examples above. You can also download it from the Parallax website to use with these
examples and with your own programs.
' =========================================================================
'
'
File...... tsl1401_template.bpe
'
Purpose... Code template for the TSL1401-DB driver firmware.
'
Author.... Parallax, Inc.
'
E-mail.... support@parallax.com
'
Started... 20 July 2007
'
Updated...
'
'
{$STAMP BS2pe}
'
{$PBASIC 2.5}
'
' =========================================================================
' -----[ Program Description ]---------------------------------------------
' This is a blank template used for interacting with the TSL1401R driver
' firmware in the MoBoStamp-pe's AVR coprocessor.
' -----[ I/O Definitions ]-------------------------------------------------
owio
PIN
' -----[ Constants ]-------------------------------------------------------
' Commands
SETLED
CON
'Flag to OR to brightness/time (0 - 127) value.
TIME
CON
INTEN
CON
SETBIN
CON
'Filter flags, ORed with filter value, NOT with SETBIN.
FLOAT
CON
FIXED
CON
WINDOW
CON
LEVEL
CON
© Bueno Systems, Inc. • TSL1401-DB (2009.10.01)
6
'Pin for OWIN and OWOUT to AVR coprocessor.
$EB
'Set LED strobe and brightness/time from next byte.
$80
'Set strobe: value (0 - 127) is 0 - 3.4mS at 100% on.
$00
'Set intensity: value (0 - 127) is 0 - 49.6% on.
$EC
'Set threshold, hysteresis, and filter (3 bytes).
$80
'Threshold is floating per filter value (0 - 7).
$00
'Threshold is fixed.
$40
'Threshold is a window (outside of hysteresis band).
$00
'Threshold is a level with hysteresis.
Page 46 of 52

Advertisement

loading