LED Countdown Clock

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
hprane
Posts: 12
Joined: Tue May 10, 2011 2:10 pm
Has thanked: 3 times

LED Countdown Clock

Post 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.. :roll:
Attachments
CLOCK.fcf
(14 KiB) Downloaded 700 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: LED Countdown Clock

Post 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.

hprane
Posts: 12
Joined: Tue May 10, 2011 2:10 pm
Has thanked: 3 times

Re: LED Countdown Clock

Post 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...
Attachments
Proteus Circuit.zip
(95.37 KiB) Downloaded 625 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: LED Countdown Clock

Post 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
Attachments
CLOCK.fcf
(20.11 KiB) Downloaded 599 times

hprane
Posts: 12
Joined: Tue May 10, 2011 2:10 pm
Has thanked: 3 times

Re: LED Countdown Clock

Post 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.
Attachments
Your Program With v4.fcf
(15 KiB) Downloaded 567 times

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: LED Countdown Clock

Post by medelec35 »

Since correct code as Ben stated is

Code: Select all

tick>122 
Then what happens to LEDs.
when you chage code from:

Code: Select all

tick<122 
to:

Code: Select all

tick>122 
Do they work correctly, if not what is the issue you have?

Attached is Ben's program with

Code: Select all

tick>122 
Compiled with FC5 to hex
Attachments
CLOCK (1).hex
compiled with FC5
(5.59 KiB) Downloaded 449 times
Martin

hprane
Posts: 12
Joined: Tue May 10, 2011 2:10 pm
Has thanked: 3 times

Re: LED Countdown Clock

Post 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?

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: LED Countdown Clock

Post by Benj »

Hello,

This v4 program should work correctly.
Your Program With v4.fcf
(20 KiB) Downloaded 545 times
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.

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: LED Countdown Clock

Post 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
Attachments
Your Program With v4b.fcf
FC4 file
(16.5 KiB) Downloaded 597 times
Martin

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: LED Countdown Clock

Post by Benj »

Aha that's the monkey, great spot Martin.

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: LED Countdown Clock

Post 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
Martin

hprane
Posts: 12
Joined: Tue May 10, 2011 2:10 pm
Has thanked: 3 times

Re: LED Countdown Clock

Post 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 :D ) to make my LED Countdown Clock for today...then i used 2 16F877A PICs for my circuit for individually control each 7segments :D ..
In 1 PIC i only needed 6 wires. But in my new way i used 7*6=42 wires :P
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... :D :D :D :D :D
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 :D ) 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.
Attachments
Working Clock.JPG
Working Clock.JPG (74.76 KiB) Viewed 9734 times
My New Worked Circuit.jpg
My New Worked Circuit.jpg (132.32 KiB) Viewed 9734 times
New & Old FC Pro Common Error.jpg
New & Old FC Pro Common Error.jpg (132.68 KiB) Viewed 9734 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: LED Countdown Clock

Post by Benj »

Fantastic glad you got it working and thanks for sharing the pictures.

Your English is a lot better then my Sinhala :D

Post Reply