Forum Discussion
assn1
New Contributor
4 years agoI need help with coding...
I'm making a digital watch code. There is no problem with the code itself, but as I input things like BUTTON_SW and BUS_SW, I didn't have enough buttons in my kit to run the hour, minute, second, an...
ak6dn
Regular Contributor
4 years agoWell, by your above module definition, BUTTON_SW is an INPUT to your module, so you can't assign to it.
You need to define a multi-bit reg which is your state variable, and based on button pushes, transition between states.
Based on the state you are in (ie, hr10s, hr1s, min10s, min1s, etc) you would use the second button push to increment the selected digit.
The final state would be the ClockRun state.