Breadboard and XOR gate not working

simulate this circuit – Schematic created using CircuitLab

70I am trying to make a circuit in which the switches will determine the outputs for the xor gate however when i used the switches it is giving me the opposite outputs. For example, a 1 & 1 should give a 0 but i am getting an output of 1.

I have attached a picture of my board.

Note the resistors connected to 5v and to switch are 470kohm and the resistor connected to led is 470 omhs.

note that for IC the VCC is on top right and grnd is on the bottom left. Also the top two pins from right after VCC are the inputs and the one below that is the output (HC86 gate).

Edit * I am not sure the schematic is correct as I was not given one to work with but I think this is essentially what I am trying to do.

simulate this circuit

Figure 3. Corrected schematic for OP to verify. [By @Transistor.]

• You need to show a schematic. There's a CircuitLab button on the editor toolbar. Commented Aug 26, 2019 at 7:20
• See the redrawn schematic, Figure 3. Is that what you're trying to draw? Commented Aug 26, 2019 at 9:13
• Yes that is the schematic I was trying to draw. Thanks Commented Aug 26, 2019 at 14:17
• Good. Keep + to the top, GND to the bottom. Use GND symbols to keep things need by avoiding wires all over the place. Make it read left to right (which you did). Try to avoid unnecessary kinks and corners. Commented Aug 26, 2019 at 14:22

Your schematic shows not what you have on your breadboard. The LED is actually connected the other way round, i.e. anode is actually at +5V, cathode is connected to gate output via resistor (in addition it should show two separate inputs for the gate).

The LED lights if the output of the XOR gate is LOW.
That's why you get the inverted output compared to what you expected.

• Ohh I got it. Thanks for the help! Commented Aug 26, 2019 at 7:47

You connected your LED from 5V to the gate, so the status of the LED will be the inverse of the output of the HC86.

If the output is 0 -> LED on, if output is 1 -> LED is off.

On the picture the switches are 0+0 so output is 0 and LED on.

Attach the anode of LED to the output of XOR gate through resistor. Attach cathode directly to the negative rail.

In fact you are getting logic 0 at the output. The LED lights because the LED has anode to +5V and cathode to 0V through resistor, so your LED lights.

• thank you I didnt realise that. Commented Aug 26, 2019 at 7:47