Let's Make Robots!

Expanding I/O’s


I have a common problem that I can’t seem to solve, my micro’s I/O line are too few, I have looked into serial shift registers but it seems to unclear to me and I get the feeling it over complicates the software for PWM. Is there any way that I can expand my I/O’s with an IC that does not have feedback, and needs a pulse to activate certain channels of that IC.(truth table) Something like a shift register but more simple to use and find.

I am planning on using a BS2 micro, I know its old but for some reason I like it.

Any information will be greatly appreciated



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.


DataP    CON  0          Data pin for 595

Clock   CON 1            shift clock

Latch    CON 2            latch

Counter    VAR BYTE


SHIFTOUT DataP ,Clock,MSBFIRST,[Counter]      ///insted of counter you can put     %01010101       8 Bits 1 is pin on 0 is pin off



Counter = Counter + 1

GOTO Again

this code will tern on the outputs   ,as the Bs2 has no set and forget PMW i found writing on's and off's into my motor subs add some speed control

I would honestly suggest you look at the PICAXE line of chips. Their price should be comparable if not better and they come with up to 40 pins total, I believe that is about 32 i/o pins(4 8 bit wide ports).

Do you need inputs, outputs, or both on the same IC?

A simple option for extra outputs is to use a 3-to-8 or 4-to-16 decoder IC. For 3 or 4 output pins you get 8 or 16 outputs, but only one of these outputs can be active at any instant, so you have to take that into account.

Apart from getting a bigger micro, there are some dedicated I/O expanders around that use I2C, SPI, or another serial comms protocol. They are essentially shift registers at heart, but they're a little more advanced so you may find them easier to use.