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...
assn1
New Contributor
4 years agoAll right, I gave it a try.
I added sw_time to the input (pressing this to move the position) and moved the corresponding time, minute, and second to reg, and added a reg called sw_t to hold it.
And so I made the code, and I succeeded in compiling it, but it works strangely in the kit.
I'm sorry I kept asking.....
always@(posedge CLK_1KHz) begin
case(sw_time)
0 : sw_t <= c_10h;
1 : sw_t <= c_1h;
2 : sw_t <= c_10m;
3 : sw_t <= c_1m;
4 : sw_t <= c_10s;
5 : sw_t <= c_1s;
endcase
end