Electronics > Projects, Designs, and Technical Stuff
16 bit to 4 digit 7 segment decoder
SiliconWizard:
--- Quote from: PA0PBZ on December 22, 2019, 06:42:21 pm ---
--- Quote from: SiliconWizard on December 22, 2019, 05:55:31 pm ---* Use the same 128Kx16 Flash chip (eg.: SST39LF200A-55-4C-EKE, ~ $1);
* Same address input: your 16 data bits, plus 2 bits for the digit index;
* Use the data output as such: 7 bits for the segments, 4 bits for the digit select (others bits can be ignored);
* Use an additional 4060 as an oscillator for the multiplexing + use two of its counter output for the digit index (to the Flash address).
--- End quote ---
Since you already have the digit index why do you need a digit select output? That way you only need an 8 bit chip.
--- End quote ---
The "digit index" is just a 2-bit binary count. The digit select output is 1-of-many select output. The former is easy to generate from the 4060 and only requires 2 more bits of address.
The 4-bit digit select output can directly be connected to each of the 4 digits' cathode (or maybe via a transistor, check output current.)
PA0PBZ:
--- Quote from: SiliconWizard on December 22, 2019, 07:04:32 pm ---The "digit index" is just a 2-bit binary count. The digit select output is 1-of-many select output. The former is easy to generate from the 4060 and only requires 2 more bits of address.
The 4-bit digit select output can directly be connected to each of the 4 digits' cathode (or maybe via a transistor, check output current.)
--- End quote ---
Ah yes, you are correct.
Benta:
--- Quote from: SiliconWizard on December 22, 2019, 05:55:31 pm ---
--- Quote from: obiwanjacobi on December 19, 2019, 06:43:19 pm ---
--- Quote from: SiliconWizard on December 19, 2019, 05:47:26 pm ---You can actually do the same with a larger EEPROM/Flash: a 128Kx16 (I saw you can find Flash parallel 128Kx16 chips for about $1 from Microchip for instance), driving 2 digits at a time instead of one. Then the multiplexing signal would need to be only one bit as above, and you can implement the multiplexing the exact same way with just one additional chip.
Sure, unless you're very against using an MCU, this will be your simplest bet here. Don't bother using extra interface chips IMO. You can easily find MCUs with enough IOs for very cheap (and you could actually add additional interfaces in it apart from the parallel data for reusing it in other settings...)
--- End quote ---
The display unit has its segments connected across the 4 digits, so I cannot use a 16-bit lookup table output. I need to multiplex its common cathodes for each digit.
--- End quote ---
Then the following arrangement would do it:
* Use the same 128Kx16 Flash chip (eg.: SST39LF200A-55-4C-EKE, ~ $1) Use a 256Kx16 Flash/EPROM/EEPROM chip (eg.: SST39LF400A-55-4C-EKE, ~ $1.50);
* Same address input: your 16 data bits, plus 2 bits for the digit index;
* Use the data output as such: 7 bits for the segments, 4 bits for the digit select (others bits can be ignored);
* Use an additional 4060 as an oscillator for the multiplexing + use two of its counter output for the digit index (to the Flash address).
Done?
The only thing is if you need to latch the input data, I think you'll need an additional chip...?
(Clearly the MCU approach or small FPGA such as iCE40 would be more flexible and would require just one chip, but if you want to go the more "discrete" path...)
--- End quote ---
4 Mb of storage to drive a 4-digit, 7-segment display? Wow, that's what I call "Brute Force"!
Especially as my post #32 shows how easy it is.
GeorgeOfTheJungle:
How about a $1 blue pill? It's got plenty of 5V tolerant gpios: http://duckduckgo.com/?q=blue+pill+pinout&iax=images&ia=images
obiwanjacobi:
BluePill: I need around 30 IO (16 bits 7/8 segements and 4 digit cathodes and possibly a latch, reset, oe that sort of thing). I don't see enough 5V pins on there.
Meanwhile I have tried to understand the code (boolean equations) I initially copied from @oPossom (never copy code you don't understand):
--- Quote from: oPossum on December 19, 2019, 11:09:16 pm ---
--- Code: --- case hex_in is
when "0000" => seg_a <= '1'; seg_b <= '1'; seg_c <= '1'; seg_d <= '1'; seg_e <= '1'; seg_f <= '1'; seg_g <= '0';
when "0001" => seg_a <= '0'; seg_b <= '1'; seg_c <= '1'; seg_d <= '0'; seg_e <= '0'; seg_f <= '0'; seg_g <= '0';
when "0010" => seg_a <= '1'; seg_b <= '1'; seg_c <= '0'; seg_d <= '1'; seg_e <= '1'; seg_f <= '0'; seg_g <= '1';
when "0011" => seg_a <= '1'; seg_b <= '1'; seg_c <= '1'; seg_d <= '1'; seg_e <= '0'; seg_f <= '0'; seg_g <= '1';
when "0100" => seg_a <= '0'; seg_b <= '1'; seg_c <= '1'; seg_d <= '0'; seg_e <= '0'; seg_f <= '1'; seg_g <= '1';
when "0101" => seg_a <= '1'; seg_b <= '0'; seg_c <= '1'; seg_d <= '1'; seg_e <= '0'; seg_f <= '1'; seg_g <= '1';
when "0110" => seg_a <= '1'; seg_b <= '0'; seg_c <= '1'; seg_d <= '1'; seg_e <= '1'; seg_f <= '1'; seg_g <= '1';
when "0111" => seg_a <= '1'; seg_b <= '1'; seg_c <= '1'; seg_d <= '0'; seg_e <= '0'; seg_f <= '0'; seg_g <= '0';
when "1000" => seg_a <= '1'; seg_b <= '1'; seg_c <= '1'; seg_d <= '1'; seg_e <= '1'; seg_f <= '1'; seg_g <= '1';
when "1001" => seg_a <= '1'; seg_b <= '1'; seg_c <= '1'; seg_d <= '0'; seg_e <= '0'; seg_f <= '1'; seg_g <= '1';
when "1010" => seg_a <= '1'; seg_b <= '1'; seg_c <= '1'; seg_d <= '0'; seg_e <= '1'; seg_f <= '1'; seg_g <= '1';
when "1011" => seg_a <= '0'; seg_b <= '0'; seg_c <= '1'; seg_d <= '1'; seg_e <= '1'; seg_f <= '1'; seg_g <= '1';
when "1100" => seg_a <= '1'; seg_b <= '0'; seg_c <= '0'; seg_d <= '1'; seg_e <= '1'; seg_f <= '1'; seg_g <= '0';
when "1101" => seg_a <= '0'; seg_b <= '1'; seg_c <= '1'; seg_d <= '1'; seg_e <= '1'; seg_f <= '0'; seg_g <= '1';
when "1110" => seg_a <= '1'; seg_b <= '0'; seg_c <= '0'; seg_d <= '1'; seg_e <= '1'; seg_f <= '1'; seg_g <= '1';
when "1111" => seg_a <= '1'; seg_b <= '0'; seg_c <= '0'; seg_d <= '0'; seg_e <= '1'; seg_f <= '1'; seg_g <= '1';
--when others => seg_a <= '0'; seg_b <= '0'; seg_c <= '0'; seg_d <= '0'; seg_e <= '0'; seg_f <= '0'; seg_g <= '0';
end case;
--- End code ---
Boolean equations
--- Code: ---seg_a_out = !( !mux & hex_in_a_3_ & !hex_in_a_2_ & hex_in_a_1_ & hex_in_a_0_
# !mux & hex_in_a_3_ & hex_in_a_2_ & !hex_in_a_1_ & hex_in_a_0_
# !mux & !hex_in_a_3_ & !hex_in_a_2_ & !hex_in_a_1_ & hex_in_a_0_
# !mux & !hex_in_a_3_ & hex_in_a_2_ & !hex_in_a_1_ & !hex_in_a_0_
# mux & hex_in_b_3_ & !hex_in_b_2_ & hex_in_b_1_ & hex_in_b_0_
# mux & hex_in_b_3_ & hex_in_b_2_ & !hex_in_b_1_ & hex_in_b_0_
# mux & !hex_in_b_3_ & !hex_in_b_2_ & !hex_in_b_1_ & hex_in_b_0_
# mux & !hex_in_b_3_ & hex_in_b_2_ & !hex_in_b_1_ & !hex_in_b_0_ );
seg_b_out = !( !mux & hex_in_a_3_ & hex_in_a_2_ & !hex_in_a_0_
# !mux & hex_in_a_3_ & hex_in_a_1_ & hex_in_a_0_
# !mux & !hex_in_a_3_ & hex_in_a_2_ & !hex_in_a_1_ & hex_in_a_0_
# !mux & hex_in_a_2_ & hex_in_a_1_ & !hex_in_a_0_
# mux & hex_in_b_3_ & hex_in_b_2_ & !hex_in_b_0_
# mux & hex_in_b_3_ & hex_in_b_1_ & hex_in_b_0_
# mux & !hex_in_b_3_ & hex_in_b_2_ & !hex_in_b_1_ & hex_in_b_0_
# mux & hex_in_b_2_ & hex_in_b_1_ & !hex_in_b_0_ );
seg_c_out = !( !mux & hex_in_a_3_ & hex_in_a_2_ & !hex_in_a_0_
# !mux & hex_in_a_3_ & hex_in_a_2_ & hex_in_a_1_
# !mux & !hex_in_a_3_ & !hex_in_a_2_ & hex_in_a_1_ & !hex_in_a_0_
# mux & hex_in_b_3_ & hex_in_b_2_ & !hex_in_b_0_
# mux & hex_in_b_3_ & hex_in_b_2_ & hex_in_b_1_
# mux & !hex_in_b_3_ & !hex_in_b_2_ & hex_in_b_1_ & !hex_in_b_0_ );
seg_d_out = !( !mux & hex_in_a_2_ & hex_in_a_1_ & hex_in_a_0_
# !mux & !hex_in_a_2_ & !hex_in_a_1_ & hex_in_a_0_
# !mux & hex_in_a_3_ & !hex_in_a_2_ & hex_in_a_1_ & !hex_in_a_0_
# !mux & !hex_in_a_3_ & hex_in_a_2_ & !hex_in_a_1_ & !hex_in_a_0_
# mux & hex_in_b_2_ & hex_in_b_1_ & hex_in_b_0_
# mux & !hex_in_b_2_ & !hex_in_b_1_ & hex_in_b_0_
# mux & hex_in_b_3_ & !hex_in_b_2_ & hex_in_b_1_ & !hex_in_b_0_
# mux & !hex_in_b_3_ & hex_in_b_2_ & !hex_in_b_1_ & !hex_in_b_0_ );
seg_e_out = !( !mux & !hex_in_a_3_ & hex_in_a_2_ & !hex_in_a_1_
# !mux & !hex_in_a_3_ & hex_in_a_0_
# !mux & !hex_in_a_2_ & !hex_in_a_1_ & hex_in_a_0_
# mux & !hex_in_b_3_ & hex_in_b_2_ & !hex_in_b_1_
# mux & !hex_in_b_3_ & hex_in_b_0_
# mux & !hex_in_b_2_ & !hex_in_b_1_ & hex_in_b_0_ );
seg_f_out = !( !mux & !hex_in_a_3_ & hex_in_a_1_ & hex_in_a_0_
# !mux & !hex_in_a_3_ & !hex_in_a_2_ & hex_in_a_1_
# !mux & !hex_in_a_3_ & !hex_in_a_2_ & hex_in_a_0_
# !mux & hex_in_a_3_ & hex_in_a_2_ & !hex_in_a_1_ & hex_in_a_0_
# mux & !hex_in_b_3_ & hex_in_b_1_ & hex_in_b_0_
# mux & !hex_in_b_3_ & !hex_in_b_2_ & hex_in_b_1_
# mux & !hex_in_b_3_ & !hex_in_b_2_ & hex_in_b_0_
# mux & hex_in_b_3_ & hex_in_b_2_ & !hex_in_b_1_ & hex_in_b_0_ );
seg_g_out = !( !mux & !hex_in_a_3_ & !hex_in_a_2_ & !hex_in_a_1_
# !mux & !hex_in_a_3_ & hex_in_a_2_ & hex_in_a_1_ & hex_in_a_0_
# !mux & hex_in_a_3_ & hex_in_a_2_ & !hex_in_a_1_ & !hex_in_a_0_
# mux & !hex_in_b_3_ & !hex_in_b_2_ & !hex_in_b_1_
# mux & !hex_in_b_3_ & hex_in_b_2_ & hex_in_b_1_ & hex_in_b_0_
# mux & hex_in_b_3_ & hex_in_b_2_ & !hex_in_b_1_ & !hex_in_b_0_ );
--- End code ---
--- End quote ---
While I get that testing for when the segments are off is cheaper (less pterms) I do not see how each segment is defined with max 4 terms (the others are for the other digit an have the same logic in them). For instance b'0001 would have 5 segments that are off - not 4.
Is there some boolean reduction technique being used here? :-//
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version