TSOP1738 versus PNA4602?


Closed Thread
Results 1 to 10 of 10

Hybrid View

  1. #1
    ra68gi's Avatar
    ra68gi Guest


    Did you find this post helpful? Yes | No

    Default

    Bruce,
    sorry it was my mistake in copying the code here. my original code did have the goto main at the end. For the convenience of those interested in this code i shall rewrite it here.

    Please answer my question as to what happens when the pause is reduced below 50ms.

    'RB0 -Transistor base driving IR leds
    'RB1-LEFT TSOP 3RD PIN
    'RB2-CENTER TSOP 3RD PIN
    'RB3-RIGHT TSOP 3RD PIN
    'RB6-INDICATION LED FOR LEFT OBJECT DETECTED
    'RB5-INDICATION LED FOR CENTER OBJECT DETECTED
    'RB4-INDICATION LED FOR RIGHT OBJECT DETECTED
    'PIN1 OF TSOP-GND, PIN2-Vss

    B0 VAR BYTE
    LEFT_COUNT VAR BYTE
    CENTER_COUNT VAR BYTE
    RIGHT_COUNT VAR BYTE
    IR_LEFT VAR BYTE
    IR_RIGHT VAR BYTE
    IR_CENTER VAR BYTE

    TRISB=%00001110
    PORTB=0

    MAIN:
    PAUSE 100
    GOSUB SEE
    IF IR_LEFT=1 THEN
    PORTB.6=1
    ELSE
    PORTB.6=0
    ENDIF
    IF IR_CENTER=1 THEN
    PORTB.5=1
    ELSE
    PORTB.5=0
    ENDIF
    IF IR_RIGHT=1 THEN
    PORTB.4=1
    ELSE
    PORTB.4=0
    ENDIF
    GOTO MAIN

    SEE:
    LEFT_COUNT=0
    CENTER_COUNT=0
    RIGHT_COUNT=0
    IR_LEFT=0
    IR_CENTER=0
    IR_RIGHT=0

    FOR B0=0 TO 30
    PORTB.0=1 'Switch on the transistor connected to IR leds.
    PAUSEUS 290 ' burst time as specified by data sheet
    IF PORTB.1=0 THEN 'Read TOSP
    LEFT_COUNT=LEFT_COUNT+1
    ENDIF
    IF PORTB.2=0 THEN
    CENTER_COUNT=CENTER_COUNT+1
    ENDIF
    IF PORTB.3=0 THEN
    RIGHT_COUNT=RIGHT_COUNT+1
    ENDIF
    PORTB.0=0 'Swith off transistor connected to IR leds.
    PAUSEUS 390 'time gap between bursts as specified by data sheet.
    NEXT B0

    IF LEFT_COUNT>=15 THEN 'take average to get flicker free or schmitt trigger
    IR_LEFT=1 'like clean output at the output pin RB6
    ENDIF

    IF CENTER_COUNT>=15 THEN
    IR_CENTER=1
    ENDIF

    IF RIGHT_COUNT>=15 THEN
    IR_RIGHT=1
    ENDIF
    RETURN
    Raghunathan.

  2. #2
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Please answer my question as to what happens when the pause is reduced below 50ms.
    My guess would be you're violating rule #5 you show above.

    When you reduce the pause time between jumps to your carrier generation
    routine below 50mS, how many bursts are you sending in 1 second period?
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  3. #3
    ra68gi's Avatar
    ra68gi Guest


    Did you find this post helpful? Yes | No

    Default

    Bruce,
    Let me do the math here.

    Carrier frequency on time= 290us pause time+30us(roughly to read the pins)
    That equals-320us
    Gap time after each burst=390us

    Total time period=320+390=710us
    This data stream is looped 31 times using for next,so total time=710*31=22010us=22ms

    Number of data burst is 31 bursts per 22ms
    so for 1sec its (31/22)*1000 = 1409bursts

    am i right Bruce?

    That means i should use pause time of more than 22ms to make the circuit function properly.
    Raghunathan.

  4. #4
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    I would factor in the time from Main & back.

    Run it through MPLAB sim with the stopwatch. Set a break point on Main. Single
    step down to Main, clear the Stopwatch, and hit run. The time it takes from
    Main & back is the time it takes to complete one full loop & emit 31 bursts.

    If you're within the timing specs shown in the data sheet, and it's not working
    as expected, then it's most likely something else like ambient lighting, circuit
    noise, other components, etc, etc,.

    A lot of things affect results with IR, and the data sheet is just a guide. Specs
    shown in most data sheets are derived under optimum laboratory conditions for the
    part under test.

    You'll normally need to make adjustments based in your own particular operating
    environment, parts used, final design, and a host of other factors.

    With 3 IR LED's all being fired at once, and 3 IR detectors, it's possible that
    you have enough bleed over to influence all 3 detectors at once. Even when an
    object isn't in front of an LED/detector pair.

    At any rate, I wouldn't try pushing it right up to the limits in a data sheet, and
    expect it to work continuously. If my car can go 160mph max I'm not going to drive
    everywhere I go at that speed...;o}
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

Similar Threads

  1. BYTE versus WORD and time
    By RussMartin in forum General
    Replies: 2
    Last Post: - 5th February 2010, 03:20
  2. PULSOUT versus toggling a pin
    By RussMartin in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 27th January 2010, 15:59
  3. SPI configuration PIC versus Atmel
    By Pedro Santos in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 10th July 2007, 19:17
  4. HIDMakerFS versus EasyHID
    By Demon in forum USB
    Replies: 4
    Last Post: - 15th August 2006, 08:01
  5. Hserout Versus Serout2
    By bethr in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 20th July 2006, 23:46

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts