Forum Discussion

RPALO3's avatar
RPALO3
Icon for New Contributor rankNew Contributor
6 years ago

How to write code of seven segment display using Nios ii in eclipse?

I want to use the i2c protocol for implementing the seven segment display in max10 Board.can anyone one help in sending any reference code of this

3 Replies

  • Ahmed_H_Intel1's avatar
    Ahmed_H_Intel1
    Icon for Frequent Contributor rankFrequent Contributor

    Hi,

    There is no certain example of displaying a seven segment display with NIOS but it is a very simple example.

    You can create an RTL code to get the value from NIOS and then translate it to 7 segment display. The NIOS can send the seven segment value to the following circuit and the value will be displayed as seven segment.

    always @*
    begin
          case(seven_seg_val)
                4'b0000: LED_out = 7'b0000001; // "0"  
                4'b0001: LED_out = 7'b1001111; // "1" 
                4'b0010: LED_out = 7'b0010010; // "2" 
                4'b0011: LED_out = 7'b0000110; // "3" 
                4'b0100: LED_out = 7'b1001100; // "4" 
                4'b0101: LED_out = 7'b0100100; // "5" 
                4'b0110: LED_out = 7'b0100000; // "6" 
                4'b0111: LED_out = 7'b0001111; // "7" 
                4'b1000: LED_out = 7'b0000000; // "8"  
                4'b1001: LED_out = 7'b0000100; // "9" 
                default: LED_out = 7'b0000001; // "0"
          endcase
     
    end

    another option is to this into the C/C++ code by using switch case for example to translate the value to 7-seg

    There are many examples online you can find like the following:

    • RPALO3's avatar
      RPALO3
      Icon for New Contributor rankNew Contributor
      Hii sir, can you send some link which could be helpful for me. Can you send the process how to proceed . Actually first time working with nios ii. So unable to figure out. Thank you Ritu