Problema con dsiplay de 7 segmentos

Any bugs you encounter with Flowcode should be discussed here.
mnfisher
Valued Contributor
Posts: 1453
http://meble-kuchenne.info.pl
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 135 times
Been thanked: 707 times

Re: Problema con dsiplay de 7 segmentos

Post by mnfisher »

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

Carmelo
Posts: 121
Joined: Thu Oct 14, 2021 10:04 am
Has thanked: 49 times
Been thanked: 4 times

Re: Problema con dsiplay de 7 segmentos

Post by Carmelo »

Ufff !!!!
Creo que eso me ha comentado es demasiado para mis conocimientos de programación con flowcode.

De todas formas, eso creo que no explica el porqué estando deshabilitada la macro de lectura de la temperatura, después del bloque de delay de 1 segundo, en la macro main, en vez de repetir el ciclo de forma indefinida, salta a ejecutarse la macro de multiplex cuando no se le llama por ningún lado.

mnfisher
Valued Contributor
Posts: 1453
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 135 times
Been thanked: 707 times

Re: Problema con dsiplay de 7 segmentos

Post by mnfisher »

The idea is that the multiplex handles all of the display duties - this runs in the 'background' keeping the displays refreshed...

I did a brief demo - again using the hardware version. Here I allow digits [0..9] and characters [A..Z] - although several of the characters can't be display for example ''M' - and display a ' ' instead...

The main 'program' needs to change the value of 'display' - which I have as a 4 character string (as I have 4 displays!)

I display 2 digits (00..99) and 2 random characters (note that due to limitations of the display some characters look suspiciously like numbers!)

So, for example, when you go into pgm mode - set display to 'PGN' - note use of N instead of M :-)

Martin
Attachments
Multiplex Chars.fcfx
(27.3 KiB) Downloaded 14 times

Carmelo
Posts: 121
Joined: Thu Oct 14, 2021 10:04 am
Has thanked: 49 times
Been thanked: 4 times

Re: Problema con dsiplay de 7 segmentos

Post by Carmelo »

Gracias por la respuesta Martín.

Luego lo reviso.

Pero lo que sigo sin aclararme es porque si deshabilito el bloque de leer la temperatura y solo están el de programación y el delay, cuando se ejecuta el delay salta a ejecutarse el bloque de lectura de la temperatura otra vez y no debería ser así.
Solo se debería ejecutar el de programación y el delay.

C.

Carmelo
Posts: 121
Joined: Thu Oct 14, 2021 10:04 am
Has thanked: 49 times
Been thanked: 4 times

Re: Problema con dsiplay de 7 segmentos

Post by Carmelo »

Solucionado el problema del funcionamiento delos displays.
Para ello he realizado una macro de multiplexado que funciona muy bien.
El proyecto esta adjuntado dentro de un post de este mismo apartado: Problema con sensor DS18B20. Allí pueden verlo.

C.

Post Reply