Re: Problema con dsiplay de 7 segmentos
Posted: Sun Mar 02, 2025 7:40 pm
I think the issue is here - rather than disabling the interrupts and doing a ShowSegments - you need to have a way to set the value to be displayed and allow the 'multiplex' macro to display it.
Similarly in multiplex - you shouldn't display to multiple segments and having a loop that waits for something is a (very) bad idea - basically the interrupt handler should be as short as possible (and should always finish before the next interrupt occurs - else the MCU can get into a lock state) The loop while tempLeida < 2 will not work as expected..
There are several approaches - one is to extend the lookup table approach so that the lookup table includes characters ('E' for example) - the displays can handle several 'letters' and although it wasteful of memory in the first instance it might be worth using the ASCII value (or ASCII - 32 (' ' space) then you can set a string for the multiplex to display, have disp_str[3] for example then on error - disp_str = 'E1' or whatever - which will be displayed until cleared..
Martin
Similarly in multiplex - you shouldn't display to multiple segments and having a loop that waits for something is a (very) bad idea - basically the interrupt handler should be as short as possible (and should always finish before the next interrupt occurs - else the MCU can get into a lock state) The loop while tempLeida < 2 will not work as expected..
There are several approaches - one is to extend the lookup table approach so that the lookup table includes characters ('E' for example) - the displays can handle several 'letters' and although it wasteful of memory in the first instance it might be worth using the ASCII value (or ASCII - 32 (' ' space) then you can set a string for the multiplex to display, have disp_str[3] for example then on error - disp_str = 'E1' or whatever - which will be displayed until cleared..
Martin