Shop OBEX P1 Docs P2 Docs Learn Events
Are I/O pins on the Stamp treated differently in terms of timing? — Parallax Forums

Are I/O pins on the Stamp treated differently in terms of timing?

ZootZoot Posts: 2,227
edited 2008-04-21 16:29 in BASIC Stamp
I ran across this little tidbit while checking out some products by Devantech. What's the deal? Is this accurate? Would this explain the occasional anomalies I've seen (and others have had) with the Ping))) and some other devices?

As many of you may know, the SRF04 is similar to the Ping))) -- high pulse trigger, measure return pulse for distance on the echo.
Devantech website said...
On the SRF04, the users host processor is required to time the returning echo. This has been an issue when using the Stamp, as it does not treat all I/O lines equally. This is an internal problem with the Stamp and was discovered by Jim Fry of Lynxmotion.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST

1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-04-20 03:43
    I've never seen or heard of this. The only cases where some I/O pins are treated differently involve specialized commands like the I2C or LCD display statements in the BS2p Stamps where certain I/O pins have specific functions. Basic I/O functions (like PULSIN) treat all I/O pins the same.

    As far as I know, the problems with the PING))) that people have had were in the PING))) itself, not the Stamp (or Propeller).
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-04-21 05:28
    Unfortunately these days Stamp refers to more than just Parallax products...Are you sure it was a BASIC Stamp the message refers to? The SRF04 is similar to the PING in some ways, but uses two I/O lines. One for triggering and one for reading the return pulse. We used to carry the SRF04 and as far as I know there were never any issues except the number of I/O pins it consumed and that the customer had to solder a header to it to use it. Now the SRF08 is I2C and there are dedicated lines for that on the BS2p models...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • Tracy AllenTracy Allen Posts: 6,666
    edited 2008-04-21 06:51
    I don't believe the time measured by a PULSIN command will vary from pin to pin, however, the story will be different for the setup time. That is the latency from the end of the previous command (PULSOUT) to the point where the PULSIN is ready to detect the leading edge of the echo timing pulse. Pin numbers 0, 1, 2, 4 and 8 will be faster in that respect than the other pins, due to the way numbers are stored in the tokenized code. Other numbers take more bits, more time for the interpreter to read them, and that delays the instant where PULSIN is ready. It is only a matter of maybe 10 microseconds, but in the case of tight timing, it might make the difference between catching the leading edge or not catching it. The alternatiive is to use RCTIME, instead of PULSIN. That would bypass having to detect the leading edge, but it would give slightly different results depending on which pin was chosen.

    That above may or may not apply to the SRF04. In general it does help to keep in mind that the Stamp has a more compact way to store the powers of two, for pins or numbers in general, and referencing powers of two judiciously leads to slightly more compact and effcient code.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com

    Post Edited (Tracy Allen) : 4/21/2008 6:56:43 AM GMT
  • ZootZoot Posts: 2,227
    edited 2008-04-21 15:35
    Tracy Allen said...
    Pin numbers 0, 1, 2, 4 and 8 will be faster in that respect than the other pins, due to the way numbers are stored in the tokenized code. Other numbers take more bits, more time for the interpreter to read them, and that delays the instant where PULSIN is ready. It is only a matter of maybe 10 microseconds,

    That makes sense -- after Mike's post I spent more time last night searching the web for more mentions of this, only because I didn't think that Gerald Coe at Devantech and Jim Frye at Lynxmotion were just pulling this out of thin air (though I found no details anywhere). And I found one mention of comparsions between PIN 1 and PIN 6. Certainly I don't think this would affect Ping usage.

    Tracy -- would the same apply to mapped pins on the AUX bank of a BS2p40 (i.e. pins 16, 17, 18, 20, 24)? And how do *you* know this fascinating little piece of ephemera?

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

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
  • Tracy AllenTracy Allen Posts: 6,666
    edited 2008-04-21 16:29
    If you are interested in the ephemera and aracana of how the Stamp interpreter works internally, I'd recommend Inside the BASIC Stamp II by Brian Forbes. Also Chuck McMannis' decoding of the BASIC Stamp I is still online here..

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
Sign In or Register to comment.