• 0
TJ

7 segment display

Question

Hello,

Regarding BASYS 2,  does anyone know how to associate a .ucf file to the actual demo board relative to inputs and outputs?  For example,  there are two sets of 4 bit inputs.  I need to understand how to define the outputs so the seven segment display will show a number 3 if I provide input 0011.  I know how to convert 0011 to display number 3 on 7 segment display using case statements using VHDL. I just dont know how to define outputs directly to basys 2 board?

I am using the family: - Spartan3E.    P/N XC3S250E- CP132

Below is example .ucf file but I need to know how to configure outputs for 7 segment display:

# Pin assignment for SWs / Inputs

NET "a_in<3>" LOC = "N3";

NET "a_in<2>" LOC = "E2";

NET "a_in<1>" LOC = "F3";

NET "a_in<0>" LOC = "G3";

NET "b_in<3>" LOC = "B4";

NET "b_in<2>" LOC = "K3";

NET "b_in<1>" LOC = "L3";

NET "b_in<0>" LOC = "P11";

# Pin assignment for LEDs / Outputs

NET "c_out<3>" LOC = "P6" ;

NET "c_out<2>" LOC = "P7" ;

NET "c_out<1>" LOC = "M11" ;

NET "c_out<0>" LOC = "M5" ;

Thanks,

TJ

 

Never mind I found it at the following site:

 

https://www.utdallas.edu/~zhoud/EE%203120/Xilinx_tutorial_Spartan3_home_PC.pdf

 

Edited by TJ
More details and fix spelling errors

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Hi

You should be able to find this elsewhere, but here is the simple overview.

You need the following constraints:

NET "sevenseg<0>" LOC = "L14";
NET "sevenseg<1>" LOC = "H12";
NET "sevenseg<2>" LOC = "N14";
NET "sevenseg<3>" LOC = "N11";
NET "sevenseg<4>" LOC = "P12";
NET "sevenseg<5>" LOC = "L13";
NET "sevenseg<6>" LOC = "M12";
NET "dp" LOC = "N13";

NET "anodes<3>" LOC = "K14";
NET "anodes<2>" LOC = "M13";
NET "anodes<1>" LOC = "J12";
NET "anodes<0>" LOC = "F12";

And then you need the appropriate top-level ports in your design:

anodes : out std_logic_vector(3 downto 0); 

sevenseg : out std_logic_vector(6 downto 0);

dp : out std_logic;

So to select a digit you need to drive one bit of anodes low, and leave the rest high, e.g.

anodes <= "1110";

or 

anodes <= "1101";

That 'enables' the corrosponding digit of the display.

You then need to set sevenseg and dp (the decimal point) to light the segments you want to see. eg

sevenseg <= "1111111"; 

... will light all segments (display the number 8) 

and maybe "1111101" might display zero (if bit 2 is the center segment).

sevenseg <= "0000000"

 Will turn off all segments on the active display.

If you want to display more than one digit on the display, you need to use clocked logic that enables one digit at a time and sets 'segment' to display the correct set of LEDs. For it to work nicely each digit needs to be shown for about 1/400th of a second. 

Share this post


Link to post
Share on other sites
  • 0

hamster,

Thank you very much.  That was very helpful.  Do you happen to know or anyone else happen to know the assignment of the other 3 of 7 segment displays?

I certainly understand that one of them is as follows:

 

NET "sevenseg<0>" LOC = "L14";
NET "sevenseg<1>" LOC = "H12";
NET "sevenseg<2>" LOC = "N14";
NET "sevenseg<3>" LOC = "N11";
NET "sevenseg<4>" LOC = "P12";
NET "sevenseg<5>" LOC = "L13";
NET "sevenseg<6>" LOC = "M12";
NET "dp" LOC = "N13";

Thanks,

TJ

Share this post


Link to post
Share on other sites
  • 0

The reference manual / wiki pages for the board has this detail.

However you could map the switches through to the segments and have a play... That should only take a few minutes to map them all out 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now