Page 1 of 1
LED Countdown Clock
Posted: Wed Jun 27, 2012 11:24 am
by hprane
I'm making a LED Countdown Clock for my schools' science day..
I used 16F877A pic and 6 common cathode 7segment displays for hour, min and sec for programming.
I used LEDs for make 7segments in circuit. The program works fine in Flowcode v4. But in the circuit LEDs does not turn on.
When program 7segments settings change to common is anode the LEDs turn on. But not correctly. Like if show number 1 it turns on other segments of number 1. Number 1 is showing by offed LEDs.
Also all 7 segments show number 2 from off LEDs and not count downing.
Our science day is start in this 29th Friday. Please help me for this...
I made the circuit using Proteus. but result is same..
I will upload my files.
Please help me..

Re: LED Countdown Clock
Posted: Wed Jun 27, 2012 12:11 pm
by Benj
Hello,
Please can you put your Proteus .dsn into a zip file and add as an attachment and I use this to confirm your findings and see if I can help fix the issue.
Re: LED Countdown Clock
Posted: Wed Jun 27, 2012 12:41 pm
by hprane
Thanks for your reply...
This is the Proteus file and a pic of my circuit. I used 4MHz Crystal..
If you can please help me with this....because I'm stuck with this now...
Re: LED Countdown Clock
Posted: Wed Jun 27, 2012 3:01 pm
by Benj
Hello,
I think I see the problem. You are outputting a number to each of the 7-seg displays but you only do this once.
As the 8 data lines are shared between all the displays you can only ever display one of the 7-segs at a time.
By cycling through all the characters repeatedly you will get a seemingly constant display from the displays.
I would advise using a timer interrupt to work out the seconds tick and use your main program loop to output to the display, see attachment.
Sorry I edited the file in v5 of Flowcode, you can download and install the demo to see what changes I made to your file.
PS - Sorry I also noticed a bug in the timertick macro.
The decision should be tick > 122 not tick < 122
Re: LED Countdown Clock
Posted: Wed Jun 27, 2012 5:21 pm
by hprane
Thanks for reply..
I made your program with Flowcode v4. Program is correct as yours. But it did not work correctly in Proteus or the circuit..
Is Flowcode v5 and v4 are different? Because your v5 program works high speed in v5 (if tik<122). But in v4 it does not work with that speed.
I download v5 demo. But in demo I cant compile to hex. mmmmm.....i don't know what to do now. I'm in totally out of mind now.
Did you check your v5 hex with Proteus...? does it work fine?
I checked it with Proteus and circuit.but my v4 program didn't work.
how can i fix this?
I'm waiting for your reply Mr.Benj. Because you are the my last hope....
Thank you...
PS- If you can make it correctly in v5 please send me the hex file with Flowcode file. Because i can't convert it with my demo version.
Thanks.
Re: LED Countdown Clock
Posted: Wed Jun 27, 2012 7:16 pm
by medelec35
Since correct code as Ben stated is
Then what happens to LEDs.
when you chage code from:
to:
Do they work correctly, if not what is the issue you have?
Attached is Ben's program with
Compiled with FC5 to hex
Re: LED Countdown Clock
Posted: Thu Jun 28, 2012 6:34 am
by hprane
Thanks for your reply..
I tried both...(if tick>122 and if tick<122). But that program doesn't work in Proteus or in the Circuit..i uploaded videos of all of it in circuit, in Proteus and my FC4....
What is the wrong with this...if you can please help me to solve it..
Video file is about 6Mb. so i uploaded it to 4shared.
Today is my last day for make it correctly...PLZ HELP ME.
Thanks again..
http://www.4shared.com/zip/aCegYKG1/Record_Videos.html?
Re: LED Countdown Clock
Posted: Thu Jun 28, 2012 9:45 am
by Benj
Hello,
This v4 program should work correctly.
As for the Proteus simulation you have wired up the 7-segs in common cathode configuration yet the 7-seg components in Flowcode are configured as common anode.
My copy of Proteus will not let me run the simulation so it looks like my license does not cover this functionality.
Should work well on hardware
Let us know how you get on.
Re: LED Countdown Clock
Posted: Thu Jun 28, 2012 12:59 pm
by medelec35
I believe I know what the issue is, but i'm on a break at work.
So not go much time, or any hardware. So unable to test if hardware is working or not.
All connections to cathodes stay low. There should be a command to clear a digit thats not being used or it will stay on all the time.
Also I agree with Ben, as I have chaged all 7segs to common cathode
So you had three issues with your flowchart called 'Your Program With v4.fcf'
I belive this is what your experincing as I have not seen the video you posted.
sorry I don't want to use your username an password to access video.
I have altered your flowchart to only have one 7seg on at a time unlike before.
Martin
Re: LED Countdown Clock
Posted: Thu Jun 28, 2012 1:04 pm
by Benj
Aha that's the monkey, great spot Martin.
Re: LED Countdown Clock
Posted: Thu Jun 28, 2012 1:34 pm
by medelec35
No problem and thanks Ben, it still might not work?
Don't know without testing.
Instead of using a load of clear commands, I thought it would be easier just to use portA to only allow one 7seg enalbed at a time.
The next step wouild be to initilses variables so will enable to start off with correct time, rather then random numbers.
Martin
Re: LED Countdown Clock
Posted: Fri Jun 29, 2012 4:33 pm
by hprane
Thanks Mr. Benj and Mr. Martin.....
Today is my that day... yesterday i tried many many times to solve my problem and in the afternoon i thought to make my own decision.. So......i thought another long way (or somtimes short

) to make my LED Countdown Clock for today...then i used 2 16F877A PICs for my circuit for individually control each 7segments

..
In 1 PIC i only needed 6 wires. But in my new way i used 7*6=42 wires
But yesterday only i needed to work it perfectly for today for my schools' science day...
You know.....I MADE IT...he he..It worked PERFECTLY today....see my uploaded pics...
My clock start at 23:59:59 i controlled 23:5 from 1 PIC and 9:59 from other PIC from same clock and same my 1st small program (with some little fixes)..
You know now im in verry verry happy...THANK YOU VERY MUCH AGAIN Mr. Benj & Mr. Martin....
I tested your FC new programs with Proteus (To test in hardware i must change my circuit again to my old type. I will test it when i'm free again)..
In Proteus your new programs also showed an error..i mean one 7segment is never turned on with old and new programs...
I think in the future i can improve my FC knowledge and solve it..then i will convert my circuit again to 1 PIC circuit...
Hmmm......Thank you for spend your time for my problem..I will never forget your help....
PS- I think my English is little (or more

) wrong all time. But I think you can understand what i said last days and now...
I will improve FC Programming and my English knowledge in the future....
Thanks.
Harshana Ranatunga.
From SRI LANKA.
Re: LED Countdown Clock
Posted: Fri Jun 29, 2012 5:09 pm
by Benj
Fantastic glad you got it working and thanks for sharing the pictures.
Your English is a lot better then my Sinhala
