Shop OBEX P1 Docs P2 Docs Learn Events
New Basic Stamp Question, probably for Mike Green. — Parallax Forums

New Basic Stamp Question, probably for Mike Green.

MovieMakerMovieMaker Posts: 502
edited 2009-04-22 23:55 in BASIC Stamp
Hey, Mike!

··· My question was:· I have all but one pin tied up on the Basic StampII.· I could use those ShiftIN and ShiftOUT chips.· But, my real question was could I use the same pins for both input and output?· Like, could I say send a signal to the IRtransmitters or Ping and wait a few moments and say, light an LED on the same line?· I don't know if I am making myself clear.·· Since the Stamp can't do two things at once, it looks like I could just adjust the timing and do something else in between.· I would like your input.

Respectfully yours,

:-)
·

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-04-22 23:53
    The 74HC164 (input shift register) and the 74HC595 (output shift register) require 3 I/O pins (clock, load, data). You can't combine different ones on the same pins since the load signal means different things on the input and output devices and the data signal is an input to the Stamp on the 74HC164 and an output from the Stamp on the 74HC595. Better would be to use an I2C I/O expander like the 8-bit PCF8574. These require 2 I/O pins on the Stamp, but you can connect up to 8 expanders on one pair of I/O pins and the expander's I/O pins can be used as inputs or outputs. The programming is more complex when you're using a BS2 because it doesn't have built-in I2C, but you can use subroutines. You can also switch to using a BS2p/pe/px Stamp which has built-in I2C statements. In that case, the I2C bus has to be either pins 0/1 or pins 8/9. You can't use other pins for that. If you're using the subroutines, you can use any pair of I/O pins.

    Several Nuts and Volts Columns discuss the use of I2C and the subroutines for use with a BS2 (or BS2e or BS2sx) are given in one of those articles.

    Using any of the I/O expander solutions is slower and less convenient than using direct I/O. I wouldn't try to use an I/O expander for time critical functions like driving a PING or trying to generate IR pulses (like at 38KHz). It won't work.
  • MovieMakerMovieMaker Posts: 502
    edited 2009-04-22 23:55
    Thanks , Mike. I knew I could count on you.

    smile.gif
Sign In or Register to comment.