Multiplexer Race Condition
Posted: Sat Sep 30, 2023 3:50 pm
Hello! I will try to be as brief as possible, but in short, I have a condition where at random, my multiplexer is giving me both inputs combined.
I have a project where I have to do an endless runner, and I'm stuck with the player controls. The player is represented by a 10 bit register where only one bit is on at the time, indicating it's position. This is also so that the 10 column LED matrix can get the display properly.
So I made shift right and shift left circuits that hold the bit at the last position, so the player doesn't just disappear. It works properly.
Now I thought I could just put a 10 bit register, set it on 1, and when either left or right was triggered I would send a signal to the register to save the value from a MUX. The multiplexer has either the right or left shift (Right shift for left player movement, LeftSH for R player movement). However, sometimes, for a split of a second it sends both, and I end up with two bits turned on. I have tried a lot of things, I think if I remove the clock and make the player move once per push the problem dissappears. But I really wanted to make it possible to just hold the button. What should I do?
I asked in another place before, and told me there was nothing to do to the MUX, but insead I should properly time the register. HoweverI don't know how.
Here you can check the player circuit and mux, sorry for the mess. If is there any further information you need please tell me: Also, I'm trying to use the circuit at a speed of 15, but I think it's present on any speed
I have a project where I have to do an endless runner, and I'm stuck with the player controls. The player is represented by a 10 bit register where only one bit is on at the time, indicating it's position. This is also so that the 10 column LED matrix can get the display properly.
So I made shift right and shift left circuits that hold the bit at the last position, so the player doesn't just disappear. It works properly.
Now I thought I could just put a 10 bit register, set it on 1, and when either left or right was triggered I would send a signal to the register to save the value from a MUX. The multiplexer has either the right or left shift (Right shift for left player movement, LeftSH for R player movement). However, sometimes, for a split of a second it sends both, and I end up with two bits turned on. I have tried a lot of things, I think if I remove the clock and make the player move once per push the problem dissappears. But I really wanted to make it possible to just hold the button. What should I do?
I asked in another place before, and told me there was nothing to do to the MUX, but insead I should properly time the register. HoweverI don't know how.
Here you can check the player circuit and mux, sorry for the mess. If is there any further information you need please tell me: Also, I'm trying to use the circuit at a speed of 15, but I think it's present on any speed