Altera_Forum
Honored Contributor
10 years ago7- Segments pin assignment for Cyclone IV EP4CE6E22C8
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