Flashing 7-segments
Posted: Fri Sep 24, 2010 12:20 pm
I have build a circuit which connects to a 3 common anode 7-segment LED display. This is for a project for a friend which I want to test out the 7-segment LED function. The program functions as follows:
1) When powered up, it displays '999'
2) Pressing the switch at Port A6 will make the display countdown. At the same time, LED connected to Port A7 will light up for 150ms.
3) It will countdown until '000' where the display will flash on and off indefinitely.
4) Pressing the switch at A4 will increase the count back to '999' in a very fast fashion, the starting point being at the current countdown value.
Initially, I used the Tutorial file #20 but there was a problem where the first two digits became very dim and i could not create the flashing function when it reaches '000'. In the enable TMR0 function, I have created a "Refresh" macro where it contains the 'Showdigit'S macros for the three 7-segment displays, but when I inserted the 5ms delay inserted between each function, the LED at A7 lit up indefinitely and the program freezes. Leaving that out, I be left with the same problem of having the first 2 digits being very dim while the third digit would be too bright.
So, I re-created the same program but without the 'Enable TMR0' function which more or less fulfilled my requirements. Unfortunately, at the LED at A7 lights up for 150ms, the 3 7-segment digits will go off instead. I have checked the circuit itself but i could not fin anything wrong with it. During the 'simulation' with Flowcode, I noticed the digits were always flickering about which I paid no heed since simulating Tutorial #20 also gave the same problem, which I attributed it to my Pentium 933 PC. By the way, I am using Flowcode 3 unfortunately. But I plan to upgrade to version 4 soon.
So, can you hep me take a look at the problem? I have included the Flowcode file for you here:
1) When powered up, it displays '999'
2) Pressing the switch at Port A6 will make the display countdown. At the same time, LED connected to Port A7 will light up for 150ms.
3) It will countdown until '000' where the display will flash on and off indefinitely.
4) Pressing the switch at A4 will increase the count back to '999' in a very fast fashion, the starting point being at the current countdown value.
Initially, I used the Tutorial file #20 but there was a problem where the first two digits became very dim and i could not create the flashing function when it reaches '000'. In the enable TMR0 function, I have created a "Refresh" macro where it contains the 'Showdigit'S macros for the three 7-segment displays, but when I inserted the 5ms delay inserted between each function, the LED at A7 lit up indefinitely and the program freezes. Leaving that out, I be left with the same problem of having the first 2 digits being very dim while the third digit would be too bright.
So, I re-created the same program but without the 'Enable TMR0' function which more or less fulfilled my requirements. Unfortunately, at the LED at A7 lights up for 150ms, the 3 7-segment digits will go off instead. I have checked the circuit itself but i could not fin anything wrong with it. During the 'simulation' with Flowcode, I noticed the digits were always flickering about which I paid no heed since simulating Tutorial #20 also gave the same problem, which I attributed it to my Pentium 933 PC. By the way, I am using Flowcode 3 unfortunately. But I plan to upgrade to version 4 soon.
So, can you hep me take a look at the problem? I have included the Flowcode file for you here: