Connect with us

Help with IC logic gate chips

Discussion in 'General Electronics Discussion' started by bacteria, Dec 2, 2010.

Scroll to continue with content
  1. bacteria

    bacteria

    24
    0
    Dec 2, 2010
    Bought a couple of logic gate IC chips, one is the 74HC08 chip

    I actually want to use an AND and also an XOR chip to decide which of two connections to connect a circuit to (the Intellivision matrix).

    On the AND I know the logic is "If A1 AND B1 are on, then Y1 is on, otherwise off".

    Here is a datasheet, there are one or two others around: http://www.datasheetcatalog.com/datasheets_pdf/7/4/H/C/74HC08.shtml

    For testing purposes, as I expect the circuit to be "on" or "off", I wanted to connect an LED into the output (added a 75ohm resistor to protect the LED) so when I press two buttons the LED illuminates.

    Connected 5v to the VCC line and ground to the grounding pin. Couldn't work out how to connect button contacts to the circuit so the LED comes on when both buttons are pressed. If I can do this, I can remove the LED and replace with what I need.

    Help?
     
  2. Resqueline

    Resqueline

    2,848
    2
    Jul 31, 2009
    ?
    Connecting both switches in series from Vcc would accomplish the AND function btw..
     
  3. bacteria

    bacteria

    24
    0
    Dec 2, 2010
    Sorry, didn't explain myself.

    My understanding is that in the diagram below:

    [​IMG]

    Pin 14 takes in 5v, and pin 7 is ground.

    Pin 1 (1A) and pin 2 (1B), are the logic inputs, so "If contact on pin 1A AND pin 1B are positive then output to pin Y1; otherwise don't"

    I've tried various combinations but nothing works. Normally "VCC" refers to a data line, but in the PDF file it refers to "VCC" as supply voltage and charts as between 4.5v and 6v, hence why I used a 5v supply.

    I know I must be doing it wrong.

    What I would be grateful for is the following information please:

    VCC connects to pin 14

    Ground connects to pin 7

    what do I connect to what so if I press both buttons an LED illuminates, pressing one or none doesn't.

    What do I connect the other contact to the buttons to, 1A and 1B connect to one pin on the switches each, but the other connection? (if it's not VCC as that seems to be voltage line input)??

    Any chance of a basic diagram please? Thanks!
     
  4. Resqueline

    Resqueline

    2,848
    2
    Jul 31, 2009
    Yes, Vcc means +5V supply in this case, GND means common "ground".
    You need to use pull-down resistors with the switches connected to inputs A & B, and the output Y can drive a LED (to ground) up to 20mA (preferably max 4mA).
    Some basics can be found here and here (just examples, there are many other places).
     
  5. bacteria

    bacteria

    24
    0
    Dec 2, 2010
    I would really appreciate it if you would please specify what I connect to what, i'm sure it's a simple chip for you to understand but it's driving me nuts at the moment:

    tact 1: connection 1: A1 (and anything else like a 10k resistor?)
    tact 1: connection 2: ? (to where?)
    tact 2: connection 1: B1 (and anything else like a 10k resistor?)
    tact 2: connection 2: ? (to where?)
    connection Y1 goes to (? positive on LED?, other LED to pin 7 for ground?)

    Once i've got the LED to work as I need, i'll be replacing the LED with the circuits I want to use, once I know i've got a handle on the AND logic gate. My real application is this BTW - using an Intellivision console, worked out the matrix on the controller; press up or right and you get normal button action plus ground; press up AND right at the same time it doesn't use ground it uses a different connection. I therefore need an AND logic gate for if both buttons are pressed at the same time to use the other connector instead of ground; and an XOR so that if it isn't an AND logic then it will use ground instead. I'm wanting to prove the gates working with some LED's initially so then I can make the IC chips connected to what I need instead.

    Help appreciated please! ;o)
     
  6. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,362
    2,758
    Jan 21, 2010
    You want to connect the switches like this:
    [​IMG]

    And drive a LED like this:
    [​IMG]

    The 74HV08 is like this inside:
    [​IMG]
    The ground connection in this image should be shown as connected to pin 7. It looks like someone's finger slipped.

    You should also tie all unused inputs to ground. That means, if you're using the inputs on pin 1 and 2, and the output on pin 3, you should tie pins 4, 5, 9, 10, 12, and 13 to ground (as well as pin 7 -- which is the ground pin).
     
    Last edited: Dec 3, 2010
  7. bacteria

    bacteria

    24
    0
    Dec 2, 2010
    Thanks so very much, got my AND logic gate working now!

    I'm going to upload a video on this in due course as part of my online guides, to hopefully help others, when i've got it all working.
     
  8. bacteria

    bacteria

    24
    0
    Dec 2, 2010
    Just realised something - need help again!

    What I actually want is if button 1 is pressed AND button 2 is pressed, then output ground via Y1; and on the XOR chip I need it to say if button 1 is pressed or button 2 is pressed but not both at the same time output a different data line via 1Y

    From what I understand, the schematics for the above outputs voltage if two buttons are pressed at the same time on AND; not "use this connection instead".

    What I really need is "if button 1 is pressed (1A) and button 2 are pressed (2A) at the same time, then take line data input from Z and output to 1Y

    Ideas please? If this is the wrong chip for what I want, what do I need please?
     
  9. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,362
    2,758
    Jan 21, 2010
    You need to look up truth tables and create one for what you want.

    For a 2 input and gate it looks like this


    A B | Q
    ---------
    0 0 | 0
    0 1 | 0
    1 0 | 0
    1 1 | 1
     
  10. bacteria

    bacteria

    24
    0
    Dec 2, 2010
    That is the truth table i'm using, and AND gate - what I was meaning was that on a normal button you have two contacts, ground and the button assigned, so for example in a game you press "A" button and the "A" button signal and ground are connected and actioned. As well as that I need to add this logic gate - problem is the logic gate needs VCC and also positive voltage, which is the issue - conflicts - ideas?
     
  11. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,362
    2,758
    Jan 21, 2010
    Are you saying that one side of your switches is connected to ground?

    If so, do this:
    [​IMG]

    This means the logic states get reversed.

    And you want a logic 1 (high) output when both buttons are pressed (i.e. both inputs are 0 (low))?

    What do you mean the logic gate needs "Vcc and a positive voltage?" Vcc IS the positive rail the circuit needs to operate.

    If the problem is that the switches pull down (as shown in this posting) rather than up (as shown in an earlier one), then the normal state is logic 1 (high), and pressing the switch pulls the input to 0V (0, low).

    So you draw a truth table for the inputs you have and the outputs you want.

    Here is the first line:

    A B | Q
    ---------
    0 0 | 1

    Since you want the output to be high when both buttons are pressed (assuming I understand what you've written).

    You complete the rest and determine what the logic function is.

    If I'm still failing to understand you, then you must resort to stuff I will understand, schematics and truth tables.
     
  12. bacteria

    bacteria

    24
    0
    Dec 2, 2010
    Ok, I know i've not helped myself with trying to describe what i'm trying to do and not communicating it effectively, so I made a diagram in the hope it is clearer:

    [​IMG]

    What do I need to do this, will the AND chip i'm using work (if so, how) if not, what do I need. It's data I need to use the logic with not voltage.

    I'd really appreciate help on this. I'm knowledgeable about console modding (what i've done so far at least) however my electronics knowledge is very poor and this resolution to the above problem would help me in other ways too.
     
  13. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,362
    2,758
    Jan 21, 2010
    OK, I see your main problem.

    You are assuming that the press of the button will result in a 1, and the release a 0.

    In fact, the opposite will happen because the switches pull to ground.

    I think it's likely that the switches already have pullup resistors (they may be internal to whatever they're connected to though). You should measure the voltage across the switches when they're open to be sure. Ideally you should see almost the full supply voltage.

    Then you need to redo your truth tables for inverted logic. Alternatively, you could wire the inputs through inverters to invert the logic back to the way you have drawn it.

    Given that this is to mod a console, I would lean toward using an 8 bit uC to read the inputs and produce the required outputs. It will have a much lower pin and package count, be more flexible, and I would imagine you're familiar with these devices already.
     
  14. bacteria

    bacteria

    24
    0
    Dec 2, 2010
    Nope, not familiar with them at all, can you please elaborate in layman's terms and what I need and how to connect, etc?
     
  15. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,362
    2,758
    Jan 21, 2010
    If you're not familiar with them, and you understand logic gates somewhat, then that may be easier.

    I just assumed that if you were familiar with modding consoles that you had some experience with uC's -- just pretend I said nothing :)
     
  16. bacteria

    bacteria

    24
    0
    Dec 2, 2010
    (*steve*) - my console modding experience to date is board reduction, relocation of components, video mods, rewiring, making consoles into portables; not programming or similar. If you want to see the sort of mods etc I have done and doing, my website is http://moddedbybacteria.wordpress.com/

    Never used logic gates until recently, I normally buy components as needed and use them, which is what I want for this application - something pre-made, easy to get hold of and I just wire my connections to it as required and it works. My electronics knowledge is very basic, I did manage to replicate a circuit to make an Intellivision output composite instead of RF, but need hand holding for much more than that.

    So, if you know of something off the shelf (eg chip, whatever) that can do what i'm after i'd be most grateful as it would help my project.
     
  17. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,362
    2,758
    Jan 21, 2010
    If you're interested in starting with PICs, you could begin by looking at the PICAXE. It has the advantage for you that the software allows programming using flowcharts, so that may be an easier way in if you have not done any programming previously.

    Think of a microcontroller as a small (and sometimes not so small) chip where you can read the inputs and set the outputs under program control (indeed you can often decide if pins are either inputs or outputs too).

    In your case, you would want a program that would continuously monitor the signals from these switches and decide from them, how to set the outputs.

    The PICAXE (in common with many microcontrollers) can be programmed over and over. So if you have a program that doesn't work, you can re-write it to fix the problem.

    My understanding of console modding is that it is not unusual for microcontrollers to be attached to certain parts of the boards in order to modify their behaviour.
     
  18. bacteria

    bacteria

    24
    0
    Dec 2, 2010
    PICAXE looks interesting, although i'm a bit loathe to buy lots of stuff without knowing exactly what I need and how to use it. I've wasted money to date on good ideas that I haven't been able to fulfil. I haven't programmed since about 1984, I used to do QBasic and a little Assembly Language, although it's pretty much forgotten now.

    Guess what i'd need is somewhere where there's a good guide of how to set up PICAXE, what you need, how to use it, etc.

    I think I have a good application for it maybe.
     
  19. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,362
    2,758
    Jan 21, 2010
    You can download the software (it's free) and I believe you can simulate the software without buying hardware (I think)

    The hardware you need is a serial cable, a couple of resistors, a breadboard and a source of power (often 3 AA batteries).

    But I understand the desire not to spend money until you have an idea of whether it will do what you want.
     
  20. bacteria

    bacteria

    24
    0
    Dec 2, 2010
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-