Hello everyone. I'm working on a small circuit using numeric keypad, register and display. I'm a bad writer so pardon me if my writing is messy . First, I'll explain my circuit so I attached a picture of the schematic I made in Multisim and also the file just in case.
When i press A numeric key, it will shows on the first display. When i press another key, previous number will displace to the second display while new number will show on first display. It will repeat the same process whenever a key is pressed.
I'm using the shift register 74194 to do the displacement but I want to remove it and use Arduino instead. I started to learn about Arduino recently so my knowledge is kinda shallow. I have a general idea of how to write the code but I don't have a concrete idea of how to do it (I hope I explained myself well).
From I have deduced is that basically what the code will do is read 4 inputs from the Decimal to BCD (74147) and write 8 outputs on the BCD to 7 Segment. So for the inputs I think I'll need to create an array and for the outputs I'll need to make an iteration for each display.
I want to know if I'm on the right track or if there is a more optimal way to do it.
I also don't know how to read the input only when a key is pressed. I have been looking for information on Google but I can't seem to find it or maybe I'm not searching correctly. I know how to read an input from a directly connected switch but I don't know how when it's from the Decimal to BCD. I was thinking about using the idea of a "Clock" like in my schematic. I connect 4 cables from the output of the Decimal to BCD to an AND gate for one input on Arduino. But I'm not sure if this will work unless I try it first.
I also don't know how to read the input only when a key is pressed.
You can't. What you do is to record each input in a variable and compare it to the last time you read it. If they are different then an input has become high or become low. The last thing you do in the loop is make previous input values the values you just read. This is known as a state change and there is an example in the IDE of how to do this.
Your idea of the key recognition won't work. If a switch bounces, the same key would be recognized multiple times. So you'll have to debounce the input anyhow.
For the shift register, you can use the shift operators << and >>, and some bit masking, to emulate the 74194 with 8 output pins.