Seven Segment Display and LCD - muneeb-mbytes/FPGABoard_edgeSpartan6 GitHub Wiki
Seven Segment Display sharing I/O with LED
-
The seven segment displays are one of the oldest & efficient types of display used in electronics applications. There displays have 8 LEDs which are separated into each segment which can be named as a, b, c, d, e, f, g, DP (decimal point).
-
These entire 8 LEDs have one end of their pins pulled out of the module as shown below and the other ends are connected together and pulled out as the Common pin. So to make patterns like numbers (0 – 9) or alphabets we just need to power common along with the other segment pin.
NET "digit[0]" LOC = P127;
NET "digit[1]" LOC = P131;
NET "digit[2]" LOC = P132;
NET "digit[3]" LOC = P133;
- digit[0] refers to the first digit of a seven-segment display, which can show numeric or alphanumeric characters through the use of seven segments that can be turned on or off.
- The "0" in "digit[0]" refers that the signal controls the first digit of the display and assigns the digit[0] signal to the pin P127 on the FPGA board which is used to control the corresponding segment of the seven-segment display.
- Similarly digit[1] to digit[3] defines the signal that controls a specific segment of a seven-segment display and assigns it to a specific pins namely P131, P132, P133 respectively on the FPGA board to enable this control.
NET "Seven_Segment[0]" LOC = P134;
NET "Seven_Segment[1]" LOC = P137;
NET "Seven_Segment[2]" LOC = P138;
NET "Seven_Segment[3]" LOC = P139;
NET "Seven_Segment[4]" LOC = P140;
NET "Seven_Segment[5]" LOC = P141;
NET "Seven_Segment[6]" LOC = P142;
NET "Seven_Segment[7]" LOC = P143;
-
This code assigns a specific input/output (I/O) pins on a Spartan-6 FPGA board to control a seven-segment display and LEDs Seven_Segment[0]" refers to the first segment of a seven-segment display.
-
The "0" in Seven_Segment[0] refers to the fact that this signal is controlling the first segment of the display. Similarly the other segments control the corresponding displays with the specific pin numbers say P134, P137,P138,P139,P140,P141,P142 and P143 which tells the FPGA synthesis software to assign the Seven_Segment signal to their respective pins on the FPGA board.
-
7 Segment is either a Common Anode display or a Common Cathode display. Circuit/program designed for Common Anode display cannot be used for Common Cathode or vice versa.
Common Cathode (CC) 7 Segment Display
In this type, the cathode pins of all eight segments/LEDs are connected (short-circuited) together. So In order to make this type of display work, we should connect the Com pin to the Ground pin and need to power the other pins with Vcc (+5V typically).
Common Anode (CA) 7 Segment Display
In this type, anode pins of all eight segments/LEDs are connected (short-circuited) together. So In order to make this type of 7-segment display work, we should connect the Com pin to the Vcc (+5V typically) and need to ground the required segment pin to turn it on (in simple words give a LOW signal from the Arduino pin to any segment of LED you want to turn it on and +5V to com pin).
Note: In Edge Spartan 6 FPGA Board we use CA configuration that is common anode 7 segment display.
LCD
NET "lcd_data(0)" LOC = "p23" ;
NET "lcd_data(1)" LOC = "p24" ;
NET "lcd_data(2)" LOC = "p26" ;
NET "lcd_data(3)" LOC = "p27" ;
NET "lcd_data(4)" LOC = "p29" ;
NET "lcd_data(5)" LOC = "p30" ;
NET "lcd_data(6)" LOC = "p32" ;
NET "lcd_data(7)" LOC = "p33" ;
NET "lcd_e" LOC = "p35" ;
NET "lcd_rs" LOC = "p34" ;
-
These pins are named lcd_data(x), where x represents the pin number (0-7).
-
The connections are made to pins p23, p24, p26, p27, p29, p30, p32, and p33, respectively.
-
These pins are used to send data from the FPGA to the LCD.
-
The ninth sentence assigns the location of the Enable pin (lcd_e) on the Spartan-6 FPGA board to pin p35. The Enable pin is used to signal the LCD that
data is ready to be read or written.
- The last sentence assigns the location of the Register Select pin (lcd_rs) on the Spartan-6 FPGA board to pin p34. The Register Select pin is used to select whether the data on the data pins is interpreted as commands or character data.