Shop OBEX P1 Docs P2 Docs Learn Events
Crazy Question about ports — Parallax Forums

Crazy Question about ports

MovieMakerMovieMaker Posts: 502
edited 2008-10-08 10:27 in BASIC Stamp
Do you think you could separate each BIT of an input and TEST it for a 1 or 0.· Doing it this way, you could have 8 inputs on the same pin and just mask them or something.· I am trying to figure a way to put more ports on the BS.· Like I said . . . crazy question.

:-)

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2008-10-06 13:07
    MovieMaker -

    You have two choices at this juncture if what you say is true. I say that because it's sometimes possible to double-up on I/O pin port usage. We'd have to know what was going on those ports to determine whether or not that's possible.

    The other two solutions are a larger Stamp (BS2p40) with 16 more pin ports or using shift registers. Each shift register chip can fetch the input status of 8 lines (devices) connected to it, or set the output status of 8 lines (devices) connected to it. Additionally shift registers can be cascaded for multiple of 8 devices, but all of those in a cascade must be either input or output, no mixing of the two.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When all else fails, try inserting a new battery.
  • AmaralAmaral Posts: 176
    edited 2008-10-06 22:29
    I don't get your question .. are you trying to reinvent a serial port ?
  • Mike GreenMike Green Posts: 23,101
    edited 2008-10-06 22:48
    Look through the Nuts and Volts Columns for a column using RCTIME and different resistor values with a capacitor to specify which switch out of several is closed.
  • MovieMakerMovieMaker Posts: 502
    edited 2008-10-07 01:54
    Thank You gentlemen for your suggestions. My new BS2px24 is on the way. Remember, I am not an engineer, only a technician.



    I appreciate your suggestions. Amaral, sorry I wasn't clear on this.



    tongue.gif
  • Mike GreenMike Green Posts: 23,101
    edited 2008-10-07 04:07
    Frankly, the labels "engineer" and "technician" are not very useful except from an HR standpoint. I've known people whose formal training was described as "technician" who were extraordinarily knowledgable and creative and some who were not at all creative and could regurgitate what they had been fed in the past, but not synthesize anything new. I've known people whose formal training was described as "engineer" who fitted the same range of description. It all depends on what you now know, what you're willing to learn, your native intelligence and creativity, and how hard you're willing to work.
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2008-10-07 05:25
    MovieMaker -

    The BS2px(24) still has only 16 I/O ports, it's just faster than the other BS2's. You MUST get the BS2p40 if you want 32 I/O ports. This Stamp has 2 banks of 16 I/O ports each. One bank of 16 I/O ports is known (in PBASIC) as MAINIO and the other bank is known as AUXIO, although they are otherwise both the same.

    Needless to say, the BS2p40 has twice as many physical pins (32) assigned to I/O ports than the other 16 pin port Stamps. Here is a handy document to keep on hand when you want to determine which Stamp might best suit your needs. It's the Stamp Technical Comparison PDF (6th download from the top):
    http://www.parallax.com/tabid/440/Default.aspx

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When all else fails, try inserting a new battery.
  • MovieMakerMovieMaker Posts: 502
    edited 2008-10-07 23:26
    Mr. Bates, I skipped over (don't know how) the Shift Register part of things. That sounded interesting. Is this only available in the 40. I have now on the way a 20. ( the BS2px24 to be exact) or is this something I can add (a special chip)?· I should be getting a Board of Education. I ordered the USB one, but they were out of stock, so I went ahead and got the SERIAL Board of Education with the USB adapter. Same difference, I think. I wanted the IRbuddy but they told me they discontinued that.

    And , Mike, I was just trying to humble myself because I have a deep desire to learn, but have no formal education. I was once extremely creative, but life 101 got in the way and I would like to get back to the point were I can tap into the creativity that I had as a teenager. I haven't really seen much of it lately.

    I is nice to have you gentlemen share your info with me. One day I hope to have that "AH-Hah!" Moment.

    smile.gif

    Post Edited (MovieMaker) : 10/7/2008 11:33:11 PM GMT
  • ZootZoot Posts: 2,227
    edited 2008-10-07 23:44
    "Shift Registers" are not built-in to Stamps (or any other microcontroller, for that matter) -- they are an external IC that lets you set a larger number of pins on that external IC to high or low, using fewer pins from the "master", or your Stamp.

    A common shift register is the 74HC595, which lets you set the states of 8 pins on the IC using only 3 pins from the Stamp. The nice thing about shift registers is that you can a) "cascade" them so that each extra IC (i.e. another extra 8 pins) only takes 1 more pin on the Stamp (after the first 3). So you could have 4 shift registers (another 32 output pins) using only 6 pins on the Stamp to control them; and b) the pins on the shift registers will stay wherever you put them until you change them again.

    They are easy to use and wire up and control with the SHIFTIN and SHIFTOUT commands (see the Stamp Pbasic Manual for examples).

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

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
  • MovieMakerMovieMaker Posts: 502
    edited 2008-10-07 23:47
    Thank You, Zoot! that is what I wanted to hear. I have ordered two 74HC595 s to go with my bs2. OK, Now I see where I would use the SHIFTIN, SHIFTOUT. I really did not understand that earlier. This was EXACTLY the info that I was looking for.

    God Bless!

    smile.gif
  • Lab RatLab Rat Posts: 289
    edited 2008-10-08 01:12
    ok i sort of understand what i am read but could you expand on it for me. do you have some files or programs that demonstrate this. also could you explain to me what the two attached files are and how to use them
    Zoot said...
    "Shift Registers" are not built-in to Stamps (or any other microcontroller, for that matter) -- they are an external IC that lets you set a larger number of pins on that external IC to high or low, using fewer pins from the "master", or your Stamp.

    A common shift register is the 74HC595, which lets you set the states of 8 pins on the IC using only 3 pins from the Stamp. The nice thing about shift registers is that you can a) "cascade" them so that each extra IC (i.e. another extra 8 pins) only takes 1 more pin on the Stamp (after the first 3). So you could have 4 shift registers (another 32 output pins) using only 6 pins on the Stamp to control them; and b) the pins on the shift registers will stay wherever you put them until you change them again.

    They are easy to use and wire up and control with the SHIFTIN and SHIFTOUT commands (see the Stamp Pbasic Manual for examples).

  • Lab RatLab Rat Posts: 289
    edited 2008-10-08 01:26
    the label only decides what you get paid i will have the technician label in about 8 months. i am currently in a technical school to become an Electro-Mechanical technician. i currently am working with the board of education which is running the bs2 i just finished putting together an LED matrix which is 7 x 10 LEDs i now have to spend the many hours to program it (joy joy) also one of the reasons i have procatinated doing the project to begin with. i am doing the project as my graduation project and i am using an 8 bit shift register as an output not only to reduce pins but to increase the speed (or so i would like to think) the IC i am using is 74LS164 i see how to use it as an out put but how do i use it as an input and please include many details (I may be a "Jenious" bt i hate research so if any one knows what they are doing or has digital resources please email them to me ThisTwoJamie72@aol.com thanks
    Mike Green said...
    Frankly, the labels "engineer" and "technician" are not very useful except from an HR standpoint. I've known people whose formal training was described as "technician" who were extraordinarily knowledgable and creative and some who were not at all creative and could regurgitate what they had been fed in the past, but not synthesize anything new. I've known people whose formal training was described as "engineer" who fitted the same range of description. It all depends on what you now know, what you're willing to learn, your native intelligence and creativity, and how hard you're willing to work.
  • Mike GreenMike Green Posts: 23,101
    edited 2008-10-08 03:40
    Lab Rat,
    Look through the Nuts and Volts Columns. There are several on expanding a Stamp's I/O using various I/O Expanders including the 74HC595 and 74HC165. Go to the main Parallax web page and click on Resources. One of the items in the list that shows up is Nuts and Volts Columns, select that and go through the index. You can also download the StampWorks Manual. Under Resources, select Downloads, then Stamps in Class Downloads.
  • Lab RatLab Rat Posts: 289
    edited 2008-10-08 10:27
    ok thanks. i have the paper copy of the whats a microcontroller manual
Sign In or Register to comment.