- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello:
I wrote simple program to count on 7 Segments Display in my board Cyclone IV EP4CE6E22C8.module seg(
input clk,
output segA, segB, segC, segD, segE, segF, segG, segDP
);
reg cnt;
always @(posedge clk) cnt <= cnt+24'h1;
wire cntovf = &cnt;
reg BCD_new, BCD_old;
always @(posedge clk) if(cntovf) BCD_new <= (BCD_new==4'h9 ? 4'h0 : BCD_new+4'h1);
always @(posedge clk) if(cntovf) BCD_old <= BCD_new;
reg PWM;
wire PWM_input = cnt;
always @(posedge clk) PWM <= PWM+PWM_input;
wire BCD = (cnt | PWM) ? BCD_new : BCD_old;
reg SevenSeg;
always @(*)
case(BCD)
4'h0: SevenSeg = 8'b11111100;
4'h1: SevenSeg = 8'b01100000;
4'h2: SevenSeg = 8'b11011010;
4'h3: SevenSeg = 8'b11110010;
4'h4: SevenSeg = 8'b01100110;
4'h5: SevenSeg = 8'b10110110;
4'h6: SevenSeg = 8'b10111110;
4'h7: SevenSeg = 8'b11100000;
4'h8: SevenSeg = 8'b11111110;
4'h9: SevenSeg = 8'b11110110;
default: SevenSeg = 8'b00000000;
endcase
assign {segA, segB, segC, segD, segE, segF, segG, segDP} = SevenSeg;
endmodule
then i connect these pin assignment clk --> pin 24 segA --> 143 segB --> 144 segC--> 141 segd --> 142 segF -->138 segG -->2 segDP --> 3 after i run this code , only the blue small LED works not the 7Seg !! now how can i run the 7 Seg ? also how can i count the & seg by pressing the push bottom ? thank you
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Seems like the following part of the code will keep always the variable BCD_new at the same condition:
always @(posedge clk) if(cntovf) BCD_new <= (BCD_new==4'h9 ? 4'h0 : BCD_new+4'h1)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Which board do you use? For the boards I have used I was able to find a .csv file with the pin assignments, which I could import. That, in combination with a board-specific top layer for the mapping of the ports to the pins, makes it easier to see the connections and know the assignment has been done correctly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I dont have the csv file , its a Chinese board. how can i get it ?
Cyclone IV EP4CE6E22C8 zr tech v2.00- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I got it from the board vendor.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page