Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Honored Contributor I
1,662 Views

7- 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
0 Kudos
4 Replies
Highlighted
Honored Contributor I
123 Views

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)
0 Kudos
Highlighted
Honored Contributor I
123 Views

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.

0 Kudos
Highlighted
Honored Contributor I
123 Views

I dont have the csv file , its a Chinese board. how can i get it ? 

 

Cyclone IV EP4CE6E22C8 

zr tech v2.00
0 Kudos
Highlighted
Honored Contributor I
123 Views

I got it from the board vendor.

0 Kudos