Home
Prox / RFID
Verichips
Ladder Logic
[interfacing] †
Tube Joints
Key Code From Photo
SolveSpace (3d CAD)
SketchFlat (2d CAD)
Photographs
Miscellany
Resume / Consulting
Contact Me

LDmicro Forum - 7 seg display clock

(you are viewing a thread; or go back to list of threads)

7 seg display clock (by frankye)
I have a 4 digit common anode and I want to do a clock with a pic 16f628
I have try your 7 seg display exemple but I have problem to complete it
can you help me? thankyou
Sun Nov 15 2009, 05:45:31
(no subject) (by Jonathan Westhues)
Maybe. Can you post the schematic of your circuit, and your program?
Mon Nov 16 2009, 00:58:18
7 seg display clock (by frankye)
thanks for reply
Mon Nov 16 2009, 03:32:56, download attachment clock3 schema.jpg
7 seg display clock (by frankye)
here is the program
Mon Nov 16 2009, 03:44:12
7 seg display clock (by frankye)
here is the program
Mon Nov 16 2009, 03:53:49, download attachment clock3.ld
(no subject) (by Jonathan Westhues)
Are your LEDs common anode or common cathode? You said common anode, but the schematic would be correct for common cathode.
Mon Nov 16 2009, 11:07:08
7 seg display clock (by frankye)
excuse me, this is the correct schematic.
my 7 seg display is common catode.
Tue Nov 17 2009, 02:56:40, download attachment clock3 schema.jpg
(no subject) (by Jonathan Westhues)
The pins in that program are not assigned, so it won't compile. So that can't possibly be the program that you loaded in the PIC. Can you post the program that you used?

And you added a rung that references digit3, which is not set anywhere else in the program. This correctly causes an error in simulation.
Tue Nov 17 2009, 03:17:03
7 seg display clock (by frankye)
the program is icprog106b
Tue Nov 17 2009, 04:44:38
(no subject) (by Jonathan Westhues)
See above; the .ld file that you posted does not even compile. So I don't know where you got the .hex file that you programmed into the PIC, but you didn't get it by compiling that program.

Or have you not tried programming the PIC yet? If that is the case, then you should just be able to assign the outputs in the .ld file according to your schematic, add a MOV instruction to set digit3, and see something happen.
Tue Nov 17 2009, 11:46:32
7 seg display clock (by frankye)
HI
This is my program,it is too big and Ican not be able to
finisch it. Can you control and correct it?
thank you.
Sat Dec 5 2009, 12:38:14, download attachment 7 seg display clock.ld
(no subject) (by Salim)
Nice Clock frankye, but one problem

01:59 then 01:00 then 02:01
02:59 then 02:00 then 03:01

Any Idea ?
Tue Nov 30 2010, 02:34:19
7 seg display clock (by Frankye)
this is my new project 7seg display clock, it is for common anode.i hope that this project will be useful for you
I want to wish happy holidays to all
Sat Dec 4 2010, 05:44:31, download attachment 7segdisplayclock.ld
error (by Frankye)
excuse me I'm wrong file, this is the right one
Sat Dec 4 2010, 05:54:27, download attachment 7 seg display clock common anode.ld
(no subject) (by Salim)
Thank you, wish happy holiday
Sat Dec 4 2010, 12:47:48
(no subject) (by Salim)
Clock is working. The problem is compare with a citizen chronometer the ladder clock became slow 40 second a day.
Sat Dec 11 2010, 02:28:50
(no subject) (by Jonathan Westhues)
There's some propagation delay in all of the logic. Normally, that's irrelevant, but when you're trying to maintain exact timing over a long period, it may introduce significant error. (And since it adds extra delay, it makes the clock run slow, as you observe.)

You can run the program in the simulator, one cycle at a time (Simulate -> Single Cycle), count the number of cycles, and adjust the program until that's correct.

Or, you can write the program in such a way that this is unnecessary, as in the attachment. Here, the variable 'cycle' is incremented every cycle time; so it counts up every 10 ms. It counts from 0 to 99; so it counts with a period of 100*(10 ms), or one second.

Then, the variable 'sec' is incremented only during the single cycle per second when 'cycle' is equal to zero. So it counts up once per second, from 0 to 59. The minute and hour counts are similar.
Sat Dec 11 2010, 02:50:43, download attachment clock-example.ld
(no subject) (by Salim)
Thank you Jonathan
Sat Dec 11 2010, 09:01:38
(no subject) (by Salim)
Using 10 ms cycle time refresh rate is slow for 7-segment LED display. Please help
Sat Dec 11 2010, 11:53:40
(no subject) (by Jonathan Westhues)
Then use a faster cycle time. The attachment was just an example; obviously, if the cycle time is half as long, and the maximum value of the 'cycle' count is twice as large, then the timing is the same. (So with a 5 ms cycle time, and a 'cycle' count period of 200 counts, the period is still (5 ms)*200 = 1 s.)

Be careful with the choice of cycle time, though. Since the cycle timer is derived from the crystal clock with an integer divisor, only certain values are possible. If you specify a value that can't be achieved exactly, then LDmicro will choose the closest possible value. This is usually okay, but not when you care about exact timing over long periods; so check the datasheet to make sure.
Sat Dec 11 2010, 12:07:48
(no subject) (by Salim)
Thank you Jonathan, it's working
Sat Dec 11 2010, 12:41:31
(no subject) (by Salim)
Using 10 MHz Crystal - 2 ms Cycle time (500*2) still is having error one second an hour.
I am beginner, please excuse me. I am asking too much.
Sun Dec 12 2010, 02:11:01
(no subject) (by Salim)
Using (1 to 5)ms Cycle time and (4, 6, 8, 10, 16 & 20)MHz crystal - result is same one second slow an hour.
Mon Dec 13 2010, 01:48:41
(no subject) (by Jonathan Westhues)
I'd have to see the exact program to comment. Though note that the way that I coded my example, the order of the rungs does matter; that's not very good form, but it does simplify things here.

If you can't figure it out, then I guess you could always just fudge it, and make the program add one extra second per hour. But it would be better to understand what's actually happening, of course.
Mon Dec 13 2010, 01:57:10
(no subject) (by Salim)
Clock
Mon Dec 13 2010, 02:10:49, download attachment 876.ld
(no subject) (by Jonathan Westhues)
Actually, now that I look at the PIC16 back end, there's an off-by-one: the timer value programmed is one more than it should be. So everything does run slower than it should, by a factor of on the order of one in a thousand.

So the actual cycle time is slightly longer than the specified cycle time. You can work around this for now by specifying a cycle time of, for example, (5 ms)*(1 - 1/3600) = 4.9986 ms, which makes everything run faster by one second per hour. But this is a bug in LDmicro, that must be fixed in the next revision.
Mon Dec 13 2010, 02:40:53
(no subject) (by Salim)
Thank you Jonathan
Mon Dec 13 2010, 03:13:29
please help me (by meiyazhakan)
how to write variable cycling timer in 7segment display with keypad
Mon Jul 1 2013, 09:34:51, download attachment timer.variable.ld
display from 1 to 20 on a 7segment 2digit common cathode (by sama)
please can some one help me on how to do this on ldmicro.WRITE FROM 1 TO 20 ON 7 SEGMENT DISPLAY 2 DIGITS COMMON CATHODE
Thu Sep 5 2013, 10:11:49
Post a reply to this comment:
Your Name:
Your Email:
Subject:
(no HTML tags; use plain text, and hit Enter for a line break)
Attached file (if you want, 5 MB max):