File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
fragment/segment_display_7 Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ // seven segment display, Show in rotation
2+ // +-a-+
3+ // f b 0b 0|0|0|0|0|0|0|0
4+ // +-g-+ -- dp|g|f|e|d|c|b|a
5+ // e c
6+ // +-d-+ dp
7+ // ---------------------------------------------------------------------------
8+ // 0 [0x3f] => a | b | c | d | e | f 5 [0x6d] => a | c | d | f | g
9+ // 1 [0x06] => b | c 6 [0x7c] => c | d | e | f | g
10+ // 2 [0x5b] => a | b | d | e | g 7 [0x07] => a | b | c
11+ // 3 [0x4f] => a | b | c | d | g 8 [0x7f] => a | b | c | d | e | f | g
12+ // 4 [0x66] => b | c | f | g 9 [0x6f] => a | b | c | d | f | g
13+ // ---------------------------------------------------------------------------
14+
15+ module show_in_rotation (input clk, output reg [7 :0 ] out);
16+ reg [3 :0 ] count;
17+
18+ always @(posedge clk) begin
19+ case (count)
20+ 4'b0000 : out <= 8'h3f ; // 0
21+ 4'b0001 : out <= 8'h06 ; // 1
22+ 4'b0010 : out <= 8'h5b ; // 2
23+ 4'b0011 : out <= 8'h4f ; // 3
24+ 4'b0100 : out <= 8'h66 ; // 4
25+ 4'b0101 : out <= 8'h6d ; // 5
26+ 4'b0110 : out <= 8'h7c ; // 6
27+ 4'b0111 : out <= 8'h07 ; // 7
28+ 4'b1000 : out <= 8'h7f ; // 8
29+ 4'b1001 : out <= 8'h6f ; // 9
30+ endcase
31+ count <= count + 1 ;
32+ end
33+ endmodule
You can’t perform that action at this time.
0 commit comments