Forum Discussion
Altera_Forum
Honored Contributor
13 years ago --- Quote Start --- I was thinking if you replaced the integer with a (0 to 15) std_logic_vector then i might be able to just split the (0 to 15) in to (0 to 3)(4 to 7)(8 to 11) & (12 to 15) convert the binary to BCD in to the 4 7 segments. Would this work? --- Quote End --- This way you simply extract the 4 hex digits, but the displayed number would still be hexadecimal. A BCD conversion would even lead to a wrong hex reading, since it trims hex digits between 0 and 9, then losing values from 0xA to 0xF. If you are please with a hex readout, then the above solution (without the BCD conversion!!!) is fair. If you really require a decimal value you must perform the true hex to dec conversion, with the mentioned divisions or any other equivalent method.