void display_multiplex(void) { clear_display(); if (display_on) { switch (shield) { #ifdef iv6_support case SHIELD_IV6: write_vfd_iv6(multiplex_counter, calculate_segments_7(data[multiplex_counter])); break; #endif #ifdef iv17_support case SHIELD_IV17: write_vfd_iv17(multiplex_counter, calculate_segments_16(data[multiplex_counter])); break; #endif case SHIELD_IV18: if (multiplex_counter == 8) write_vfd_iv18(8, g_iv18seg0); else write_vfd_iv18(multiplex_counter, calculate_segments_7(data[7-multiplex_counter])); break; #ifdef iv17_6digit_support case SHIELD_IV17_6D: write_vfd_iv17_6d(multiplex_counter, calculate_segments_16(data[multiplex_counter])); break; #endif default: break; } } multiplex_counter++; if (multiplex_counter == mpx_limit) multiplex_counter = 0; STROBE_HIGH; // Pulse Strobe to update Latch data STROBE_LOW; }
// display multiplexing routine for 4 digits: run once every 1 ms void display_multiplex_iv17(void) { clear_display(); switch (multiplex_counter) { case 0: write_vfd_iv17(0, calculate_segments_16(display_on ? data[0] : ' ')); break; case 1: write_vfd_iv17(1, calculate_segments_16(display_on ? data[1] : ' ')); break; case 2: write_vfd_iv17(2, calculate_segments_16(display_on ? data[2] : ' ')); break; case 3: write_vfd_iv17(3, calculate_segments_16(display_on ? data[3] : ' ')); break; } multiplex_counter++; // g_brightness == 1 thru 10 if (multiplex_counter == (4 + (18 - (g_brightness-1)*2))) multiplex_counter = 0; }