# a reversing polarity?

Discussion in 'General Electronics Discussion' started by flip84, Mar 6, 2014.

1. ### flip84

6
0
Mar 6, 2014
For an electronics project I made a tic tac toe board. Soldered LED's on proto boards. I used an old cell phone charger as the power supply. (5V DC 700mA) It's tied to toggles switches, single pole double throw. then moves to the GAL16V. (it's purpose is that when a winner gets 3 in a row on tic tac toe it has an output to light up the winner.) however the problem is that the chip is programmed to read either low or high, but the voltage reading at the pins are high when the toggle switch is on but when it's off it own't read low because there's a negative volatge? Sometime -6V sometime up to -16V. I don't understand why this polarity is being flipped, why or how? Would a voltage rectifier help remove the negative voltage so the chip can operate in it's parameters? Or is there a way to write in the code to ignore or include the negative voltage with the low? The professors at my school don't understand why the polarity gets reversed, one thinks it's the toggle switches but I don't see how.

2. ### BobK

7,682
1,688
Jan 5, 2010
Show us a schematic. I am going to guess that it is floating when in one position.

Bob

3. ### flip84

6
0
Mar 6, 2014
Well there isn't a schematic. For the project we were supposed to design our own. It's my first I've done and I just designed from my head. Basically though it's just wire going from voltage supply to a toggle switch (single pole double throw), then to either i.c. chip, (GAL16v8 one for the x's, one for the o's) then from there to led's which are grounded with 100ohm resistor. Also the about the GAL. pins 1-9 are for the inputs, 10 grnd 20 VCC and pin 19=WIN, WIN= the 8 different possible combinations of three in a row tic tac toe. The pins wont read low when off because of the negative voltage thts why I'm wondering if a rectifier would fix this or if different wording in the coding could change it.

Last edited: Mar 7, 2014
4. ### BobK

7,682
1,688
Jan 5, 2010
So, when the switch is not connecting the supply voltage to the GAL input, what is driving that input?

Bob

5. ### flip84

6
0
Mar 6, 2014
well the supply voltage is a cellphone charger. I cut the end end put fixings on it to connect to a bread board so there's no on off switch unless unplugged. However on the toggle switch, when in the middle position (off) both of the ons are low, but when switched to ON, say to the right, then the left connection would have the negative voltage.

6. ### BobK

7,682
1,688
Jan 5, 2010
Thanks for the response, but you did not answer my question which is intended to lead to the way to correct the problem.

When then switch is to the right, what is connected to the GAL input that is connected to the left side of the switch?

Bob

7. ### flip84

6
0
Mar 6, 2014
oh, sorry. Just a wire from the switch to GAL then wire from there to the led then to a resistor then to ground

8. ### BobK

7,682
1,688
Jan 5, 2010
Then the input is floating when the switch is not in the activated position. Floating inputs are not good, you have to provide a valid logic level on an input at all times. In this case, you would use a pulldown resistor from each input to ground.

Bob

9. ### flip84

6
0
Mar 6, 2014
Bob, thank you for the advice. You are correct.I suggested that to the professor. After discussion about the possible different ways to program the chip and little trial and error, and him deciding that feedback was our problem, in the end a 1K ohm pulldown resistor at each input to the GAL fixed my problem. Thank you

10. ### flip84

6
0
Mar 6, 2014
Also for future interest maybe I didn't specify. The cause of the floating voltage or feedback what ever, was due to the fact that I was never explained to or given the schematic of the toggle switch or any switch in general. I used two leads to direct the current and voltage but the middle lead was used to bring in VCC, not to ground or as a common. ( I Put it at the beginning of the circuit not the end. I thought the switch was there to direct the voltage in. Which it does just in reverse of how I thought, not to complete the circuit at the end by grounding it.) However the resistors worked liked you suggested and I will pass with an A in my classes and thank you again

Last edited: Mar 8, 2014