Taming the Beast (3) March 2013

The topic on number crunching

Postby ag » Sat Mar 09, 2013 12:00 am

For anyone interested,

As a solution for the homework task at the end of the article I had envisioned wiring the inputs of 7 LUT4 symbols in parallel, 1 LUT4 for each segment of the display. But I had some problems understanding how to set the INIT values in the LUT symbols, until I found this link:

http://www.markharvey.info/fpga/init/index.html

Example: LUT4_1 should drive the A-segment. The A-segment should light for digits 0, 2, 3, 5, 6, 7, 8, and 9. Thus, for the following input values:

0 = 0000
2 = 0010
3 = 0011
5 = 0101
6 = 0110
7 = 0111
8 = 1000
9 = 1001

Since the only 7-segment displays I could salvage out of my obsolete analog satellite receivers were all of the common anode variety, that gives for me the following truth table:

I3 I2 I1 I0 O

0 0 0 0 0
0 0 0 1 1 2
0 0 1 0 0
0 0 1 1 0

0 1 0 0 1
0 1 0 1 0 1
0 1 1 0 0
0 1 1 1 0

1 0 0 0 0
1 0 0 1 0 C
1 0 1 0 1
1 0 1 1 1

1 1 0 0 1
1 1 0 1 1 F
1 1 1 0 1
1 1 1 1 1

resulting in the INIT value for LUT4_1 = FC12

If you happen to be using common cathod displays as used in the article, you need to flip the 0 and 1 values in the output column of the truth table before calculating the INIT values. In the example above for the A-segment that would look like this:

I3 I2 I1 I0.........CA CC.....CA.........CC

0 0 0 0...............0 1
0 0 0 1...............1 0........2 ........D
0 0 1 0...............0 1
0 0 1 1...............0 1

0 1 0 0...............1 0
0 1 0 1...............0 1........ 1........E
0 1 1 0...............0 1
0 1 1 1...............0 1

1 0 0 0...............0 1
1 0 0 1...............0 1........ C........3
1 0 1 0...............1 0
1 0 1 1...............1 0

1 1 0 0...............1 0
1 1 0 1...............1 0........ F........0
1 1 1 0...............1 0
1 1 1 1...............1 0

resulting in INIT value for LUT4_1 = FC12 for common anode
................................................. = 03ED für common cathode

I have enclosed my successfully tested complete solution for the common anode version of the lookup table based 7-segment decoder in the attached file.

Regards,
Ag
Attachments

[The extension sch has been deactivated and can no longer be displayed.]

Ag
ag
 
Posts: 533
Joined: Thu Jan 02, 2014 10:37 am

Return to Microcontrollers & Embedded

Who is online

Users browsing this forum: No registered users and 1 guest