Shop OBEX P1 Docs P2 Docs Learn Events
Running tsl1401_scan on a BS2SX ... help with timing — Parallax Forums

Running tsl1401_scan on a BS2SX ... help with timing

CliffSCliffS Posts: 12
edited 2010-06-15 18:25 in Accessories
Hi there,

I'm trying to get the TSL1401 sample program tsl1401_scan.bs2 to run with a BS2SX.

It is not working ... I assume because of timing issues.

For the BS2, I suspect that critical values are in subroutine GetPix:

exp = 8333 'Set exposure time to 8333uSec (1/120th sec) for the BS2
...
PWM clk, 128, 1 'Rapidly send 150 or so CLKs for the BS2
...
PULSOUT si, exp >> 1 MIN 1016 - 1016 'Wait for remaining integration time on the BS2


Since the BS2 runs 2.5 times faster, I'd assume that I should reduce EXP to 3333
and change the PULSOUT line to be:

PULSOUT si, exp >> 1 MIN 299 - 299

These alone do not make the program work. *sigh*

Should I modify the PWM clk, 128, 1 ???

Any suggestions?

MANY THANKS!
-Cliff

Comments

  • CliffSCliffS Posts: 12
    edited 2010-06-15 17:33
    I figured it out, seems to be working now.

    Here's some information for those who are fooling with the TSL1401 scanner:
    you may wish to closely examine the sample program.
    (the documentation, while well written, left me a bit confused; here's my take on it)

    The sample program, TSL1401_SCAN.BS2, handles the integration of light (exposure) by taking two exposures and only using the second one.

    So the first SHIFTOUT followed by the PWM CLK causes an exposure to happen, but not be collected by the stamp.

    Then the PULSOUT command causes a pause in the program while the sensor integrates the exposre.
    (asd the documentation points out, a PAUSE could have been substituted for this step)

    After the PULSOUT pause happens, the sensor is read out a second time by:
    SHIFTOUT (to clock out the sensor)
    immediately followed by a pair of SHIFTINs which collect the data


    Right now, I'm just fooling around, so exact exposure can be controlled by adjusting the light.
    In this case, the first SHIFTOUT, PWM,and PULSOUT can be eliminated.
    This results in the exposure time being determined by the speed of your stamp program.
    It also causes your program to run faster, since there's no longer a wasted scan.

    Cheers to all,
    -Cliff
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-06-15 18:25
    Thanks, Cliff! That will help a lot of users.

    -Phil
Sign In or Register to comment.