Shop OBEX P1 Docs P2 Docs Learn Events
I/O pins question — Parallax Forums

I/O pins question

skatjskatj Posts: 88
edited 2008-02-26 21:59 in BASIC Stamp
I feel really dumb asking this, but what is the difference between the serial I/O in the servo ports and the I/O pins lining the breadboard on the BOE?

I ask this because I am using both servo port 15's I/O line to read a square wave value from an r/c receiver, as well as I/O pin 15 to interface my floating point coprocessor.

Somehow, the stamp can tell the difference when I specify "15" as the pin number in the PULSIN command.

However I will be using I/O pins for the other channels on my receiver, so I was wondering if anybody could tell me the difference?

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2008-02-25 05:24
    skatj -

    I don't have a BOE handy, but I suspect I know the answer to your question. In one case you are using Pin Port 15 as an Input, and in the other case you are using it as an Output.

    The Stamp doesn't have to "know" anything about the pin itself, or where it's located. It only cares that you have specified a Pin Port (whichever one you choose) and uses that one as you have specified. I hope that makes sense to you.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "Genius is one percent inspiration and ninety-nine percent perspiration."

    Thomas Alva Edison
  • skatjskatj Posts: 88
    edited 2008-02-25 06:45
    I haven't defined any pin or port as an input or output.

    I haven't defined my FPU pins either, although I have them physically connected to pin 15 on the breadboard.
    When I integrate this code into my main program, will there be conflicts? (the "other", non-port pin 15 is both an I and an O I believe)

    ' {$STAMP BS2p}
    ' {$PBASIC 2.5}
    
    
    RXin6 CON 15
    
    Dial   VAR Word
    
    DO
    PULSIN RXin6, 1, Dial
    
    DEBUG "=======================================", CR, CR
    DEBUG DEC ? Dial, CR
    
    
    PAUSE 1000
    LOOP
    
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2008-02-25 08:01
    skatj -

    What you may mean to be saying is that you haven't EXPLICITLY defined any pin or port as Input or Output. That is quite true. However, the PULSIN command does that for you. Here is an excerpt from the PBASIC Help File in reference to the specified PULSIN pin port:

    "Pin is a variable/constant/expression (0 - 15) that specifies the I/O pin to use. This pin will be set to input mode."

    As you can see, PBASIC will set the specified pin port to Input (or Output, as the case may be) for you. The PBASIC documentation will tell you when it does this for you, and when it must be done by you.

    We·can't predict whether you will have any future pin port conflicts until·we see the rest of·your program. If you follow what was said above, you shouldn't expect any problems.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "Genius is one percent inspiration and ninety-nine percent perspiration."

    Thomas Alva Edison
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-02-26 21:59
    While some details seem to be unclear, one thing that you should be aware of is that P15 on the I/O header and P15 on the servo header are electrically connected and one in the same. They definitely should not be connected to multiple devices, especially if one device is input and one is output. You can have some serious pin conflicts doing this.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
Sign In or Register to comment.