Shop OBEX P1 Docs P2 Docs Learn Events
TSL230 issues — Parallax Forums

TSL230 issues

skynuggetskynugget Posts: 172
edited 2009-05-11 22:11 in General Discussion
hey all im playing with a tsl230 light to frequency converter on an sx28. With the following code, my output is not the same as if i where to use the stock demo code for the bs2. im just testing with the sensitivity disabled for now. When i run the following sx/b code, the value of reading increments by a value of 256.. ie 0 256 512 768 ....... running the bs2 code i have a value of 80 (in my current light conditions) on the sx28 its sitting at 0 until flash a light on it. any ideas? thanks in advace!!

sx/b 2.0 code:
DEVICE          SX28, OSCXT2, BOR42
FREQ            4_000_000
STACK           16


TSL230                pin        RA.2 input
tmpw1                 var         word
reading                 var         word

GET_LIGHT            func        2    word

PROGRAM Start


Start:
     reading = get_light
    WATCH reading, 16, udec
    BREAK
  
GOTO start



func GET_LIGHT
    tmpW1 = 0    
    count TSL230, 200, tmpw1
    return tmpw1
endfunc

Comments

  • ZootZoot Posts: 2,227
    edited 2009-05-10 16:08
    The Stamp demo uses a 100ms measuring period for COUNT, not 200ms. Could that be it? The only other thing might be if you have the enable/sensitivity pins wired differently when you moved it to your SX project board. Grasping a bit at straws here...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
  • skynuggetskynugget Posts: 172
    edited 2009-05-10 17:22
    hey zoot, i tried it with 100ms and it exhibited even more weird (really didnt work at all). So i figured the sx was sweeping it to fast or something. im using a PDB with a stamp and an sx in it running at the same time... im just moving one wire to test.

    does COUNT work differently in SX/B then in stamp basic?
  • BeanBean Posts: 8,129
    edited 2009-05-10 20:50
    Skynugget,
    · I had a look at the compiled code, and there is a bug in the COUNT command.
    · I will post a corrected version of the compiler tomorrow.

    · Thanks for catching that...

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    There is a fine line between arrogance and confidence. Make sure you don't cross it...



    Post Edited (Bean (Hitt Consulting)) : 5/10/2009 9:03:02 PM GMT
  • skynuggetskynugget Posts: 172
    edited 2009-05-10 21:06
    WoW i caught a bug!!! I'm somebody now! thanks for checking it out bean.
  • Shawn LoweShawn Lowe Posts: 635
    edited 2009-05-11 04:30
    LOL! Good one skynugget!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Shawn Lowe


    When all else fails.....procrastinate!
  • BeanBean Posts: 8,129
    edited 2009-05-11 11:10
    skynugget,
    · I have posted version 2.00.23 of the compiler.·http://forums.parallax.com/attachment.php?attachmentid=0
    · This should fix the bug you found.
    · Thanks again for your post. It is users like you who make the compiler a better product.

    · Let us know if it works now.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    There is a fine line between arrogance and confidence. Make sure you don't cross it...



    Post Edited (Bean (Hitt Consulting)) : 5/11/2009 2:09:43 PM GMT
  • skynuggetskynugget Posts: 172
    edited 2009-05-11 22:11
    Thanks Bean, Its Fixed!!!

    For anyone else check the sx2.0 thread, the link posted above no longer works cause Bean fixes so much stuff so fast:

    http://forums.parallax.com/forums/default.aspx?f=7&m=323767

    Post Edited (skynugget) : 5/12/2009 12:18:57 AM GMT
Sign In or Register to comment.