Shop OBEX P1 Docs P2 Docs Learn Events
Using 4 I/O lines as Binary Outputs — Parallax Forums

Using 4 I/O lines as Binary Outputs

KraZe_EyEKraZe_EyE Posts: 15
edited 2008-11-11 14:42 in BASIC Stamp
Hello,

I haven't used these fourms in a while because I haven't played with my stamp in a while.

Anyways for my digital class I am doing things a little differently and need you guys help on something.
I'm using an external memory chip that stores 1024 4 bit binary numbers selectable via a 4 address pins.
I am using a keypad to select memory locations 1-9; I dont need anymore then that. And, yes I could store them in the stamp but I need to use this chip.

My question is If i select memory location, say 3 (0011) how do I 'break apart' the binary number into sections, 0 - 0 - 1 - 1, to be outputted on 4 output pins? Also how do I do the reverse; read 4 IO pins and then store that number as a whole binary number?


Stamp IO | Address of Memory

IO 1
A
IO 2
B
IO 3
C
IO 4
D



I haven't started to code yet so don't ask for my program

Post Edited (KraZe_EyE) : 11/10/2008 8:40:19 PM GMT

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-11-10 20:40
    The Stamp I/O pins are grouped in groups of 4 pins and 8 pins with names for each group. See the PBasic Manual in the section on memory use. For example, I/O pins 0-3 are named INA and OUTA for input and output respectively. There's also direction pins DIRA. Similarly, there's OUTB, OUTC, and OUTD. If you connect your address pins to a group of 4 pins, you can use the appropriate name to set all 4 pins from the lower 4 bits of a value.
  • KraZe_EyEKraZe_EyE Posts: 15
    edited 2008-11-10 20:51
    Another question, I have a cable going from the header of the stamp, center of the BOE, to a larger breadboard. My MEMKEY says that the Vdd & Vss have to be at the same potential, I can't run an external supply for the breadboard and use my stamps battery supply at the same time, Right?
    Solution!?! Disconnect my stamps power supply and connect Vdd to the 5v rail of my breadboard and Vss to the ground rail? Power supply is rated 5v @ 5A.
  • KraZe_EyEKraZe_EyE Posts: 15
    edited 2008-11-10 21:59
    Yes I am still wondering If I can connect my Stamp as described above?

    connect Vdd to the 5v rail of my breadboard and Vss to the ground rail?

    Power supply is rated 5v @ 5A.
  • Carl HayesCarl Hayes Posts: 841
    edited 2008-11-11 13:53
    You can hook them together as you describe, and run both from a single 5v supply. Or you can use separate supplies and connect the two Vss together but leave the positives separate. Either way will work.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    · -- Carl, nn5i
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-11-11 14:42
    +1 Carl. You CAN run with two different supplies -- one powering the BS2, one powering your logic board,

    IF AND ONLY IF:

    1. You connect the Vss of the BS2 to the ground of the logic board.

    2. You don't connect the Vdd of the BS2 to the +5 of the logic board.
    When you do this, the logic signals from the BS2 will be referenced to its Vss.
    Since you've connected Vss to the logic board ground, this will insure those signals are ALSO referenced to
    the logic board ground, and will be able to drive the chips.
    Other alternatives are as Carl has said: Leave Vin unconnected, and connect the BS2 Vdd to the logic board +5 supply,
    and of course the BS2 Vss to the logic board ground. With 5 amps to play with, this would be a more typical scenario.

    Note you MUST NOT connect more than +5 volts to the BS2 Vdd pin, or you risk destroying the BS2.
    Note the BS2 also has a 'brown-out reset' circuit, which will reset the BS2 if the +5 volts falls too low.
Sign In or Register to comment.