1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

K8LH Novelty Single Chip Clock

Discussion in 'Electronic Projects' started by Mike - K8LH, Aug 8, 2008.

Thread Status:
Not open for further replies.
  1. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,291
    Likes:
    647
    Location:
    Derbyshire, UK
    ONLINE
    Check the 'Hardware Extras' section of my tutorials for an example.
     
  2. Space Varmint

    Space Varmint New Member

    Joined:
    Jul 10, 2008
    Messages:
    1,487
    Likes:
    11
    Location:
    Tucker GA...USA
    I don't see it. Mind pointing that out? What's the matter? Don't like assembler?
     
  3. Mike - K8LH

    Mike - K8LH Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    3,641
    Likes:
    109
    Location:
    Michigan, USA
    The "software trimmer" routine is described briefly in the 3rd or 4th post in this thread...

    Cap values for crystal
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. 3v0

    3v0 Coop Build Coordinator Forum Supporter

    Joined:
    Jul 14, 2006
    Messages:
    9,404
    Likes:
    227
    Location:
    OKLAHOMA USA

    What on earth is this all about. Everyone is free to program in the language of his or her choice.
     
  6. Space Varmint

    Space Varmint New Member

    Joined:
    Jul 10, 2008
    Messages:
    1,487
    Likes:
    11
    Location:
    Tucker GA...USA
    Go back. There's two things. First let me say this guy has done a very fine job on his clock. I like it very much and clocks interest me to begin with. So I threw in an old clock I had done a few years back and it had what I think is a unique feature. All the clocks I have seen usually have an adjustable capacitor to compensate for crystal discrepancies or stray capacitance where the clock will run ever so slightly fast or slow. It is usually very fine and may take a week to show up. I put a programmable adjustment in it that will do the same thing as a capacitor. It is a very fine adjustment that uses the timer and two delay loops that inter-act with each other. He told me this program also had it and I asked him to point it out please because I didn't see it. Then he bashed my code. Well I can't figure that out either except that it is in assembler so I'm just trying to figure out why. I thought since the OP was still building his clock he might get some ideas from it. No biggy. No hard feelings here :D

    edit:

    Another thing is even on the 8253 TIC which is used in PC's their software correction occurs every few seconds to minutes. This one has all seconds the exact same length of time.
     
    Last edited: Sep 16, 2008
  7. 3v0

    3v0 Coop Build Coordinator Forum Supporter

    Joined:
    Jul 14, 2006
    Messages:
    9,404
    Likes:
    227
    Location:
    OKLAHOMA USA
    SV,

    I am a C guy. I can read and write a little ASM but it help if there are lots of good comments and I have the cheat sheet nearby. IMHO we invented compilers for a very good reason... but as I said to each his own.

    But for the above reason I am not in any position to get in the middle of a debate about asm code.

    EDIT: I know I sort of stuck my big nose in this one.
     
    Last edited: Sep 16, 2008
  8. Space Varmint

    Space Varmint New Member

    Joined:
    Jul 10, 2008
    Messages:
    1,487
    Likes:
    11
    Location:
    Tucker GA...USA
    Well you asked for it didn't ya? No prob man. It's just I was probably programming when he was in diapers and he's gonna tell me my code sucks? He don't even understand it. ;)
     
  9. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,080
    Likes:
    326
    Location:
    Brisbane Australia
    Mike (the OP) already pointed out the post I had in mind, see above.

    I did not realise that you had written the code and I called it horrible because it is not even source code, it is a disassembly listing. This makes it very difficult to understand or use and practically impossible to alter. It also uses timer 0 which is a very bad timer to use for any sort of RTC. It writes values to the timer0 counter which always zeroes the prescaller. This combined with the variable latency of the interrupt will cause timing errors.

    As for not liking assembler, I wrote my first assembler program around 1980 and have been writing in it every since.

    Mike.
     
  10. Space Varmint

    Space Varmint New Member

    Joined:
    Jul 10, 2008
    Messages:
    1,487
    Likes:
    11
    Location:
    Tucker GA...USA
    There you are. I'm glad you didn't get banned. There was talk in chit-chat I'm sure you know.
    Any latencies will be the same length of time as long as they are done the same way (TMR0). I know this without a doubt because I have used the same technique to produce a reference frequency for a PLL. I had a receiver tuned to the output frequency of the PLL with the BFO turned on so that I had a beat note (tone/pitch). If that were true what you said then I would hear a change in the pitch. The receiver was also digitally locked. I could purposely change the frequency by changing the "jam load" value and to demonstrate just how redundant the timing is with TMR0 I was able to use the timer to run through a do nothing loop and by changing an instruction I could change frequency just do to the different machine cycle times for different instructions.

    Summary: Latencies are repetitive not random.
     
  11. Mike - K8LH

    Mike - K8LH Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    3,641
    Likes:
    109
    Location:
    Michigan, USA
    Space Varmint,

    Please get your facts straight. I am the Original Poster (OP) and I didn't make any comments about your example program, good or bad.

    I also use a "software trimmer" of sorts in some of my Clock projects but did not include it in this novelty single-chip design.

    Thank you for pointing out the feature and for the program example.

    Mike
     
  12. Space Varmint

    Space Varmint New Member

    Joined:
    Jul 10, 2008
    Messages:
    1,487
    Likes:
    11
    Location:
    Tucker GA...USA
    I got my facts straight. Basically the guy bashed my code and told me you had software correction and I told him I didn't see any. I guess that's because there wasn't any. There are many techniques that can be used and I invented one that makes all seconds the same length of time which is not the way it is normally done. Even on the PC it is more erratic as the seconds are corrected over a period of minutes where you may only have 59 seconds in some of the minutes instead of 60 seconds in all minutes. I figured since you were still working on your clock you might be interested in adding it in. I was only trying to help.

    PS Are you a ham? WA4BJO here. I'm an OM 36 years.
     
    Last edited: Sep 19, 2008
  13. Mike - K8LH

    Mike - K8LH Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    3,641
    Likes:
    109
    Location:
    Michigan, USA
    Space Varmint,

    I don't think you got your facts straight. First of all Pommie didn't say I had software correction in this clock code, he said I had posted a method for software correction. Here's his quote;

    The wording in your post suggests that I bashed your code. Basically you say "this guy" came up with a nice clock and then you go on to say "he" bashed your code. Without specifying that "he" was Pommie you leave the reader thinking that "this guy" (me) and "he" are the same guy and I resent the implication. Your subsequent posts are similarly misleading. That is, you're not specifying exactly who you're talking about.

    Anyway, I congratulate you on coming up with a unique "software trimmer" implementation. As you may know, the general method as described on PICLIST is quite old. I came up with a simple workable Timer 2 implementation which also applies the correction per second and described it on Forum.Microchip in the following thread in the Tips-n-Tricks sub-forum on July 16, 2006; Clever and Useful Tricks (post #18)

    I'm a pretty good assembly language programmer but I didn't comment on your example program because the formatting and comments made it difficult (for me) to understand.

    If you would like to share your Timer 0 implementation of the method then may I suggest you clean it up a little and post it in a new thread?

    Kind regards, Mike
     
    Last edited: Sep 19, 2008
  14. Space Varmint

    Space Varmint New Member

    Joined:
    Jul 10, 2008
    Messages:
    1,487
    Likes:
    11
    Location:
    Tucker GA...USA
    Hey no problem. So you got one? Is it accurate? Great! I'm too busy right to make a new thread. I just threw this in a clock thread. I did it about 5 or 6, maybe 7 years ago. Then I moved on ;) .
     
  15. artisticdriver

    artisticdriver New Member

    Joined:
    Nov 20, 2008
    Messages:
    1
    Likes:
    0
    Nice circuit, i'm going to use this as my grad project. Can you list the parts that you used so that i can start ordering them asap?
     
  16. 3v0

    3v0 Coop Build Coordinator Forum Supporter

    Joined:
    Jul 14, 2006
    Messages:
    9,404
    Likes:
    227
    Location:
    OKLAHOMA USA
    Lets see, you spent how much of your parents money to get an education. For your grad project the best you can do is steal a design off the net. To top that you can not even figure out what parts you need to build it.

    Anyone interested in giving this nice young man a job.
     
    Last edited: Nov 20, 2008
  17. sananh

    sananh New Member

    Joined:
    Oct 13, 2007
    Messages:
    6
    Likes:
    0
    Finished project

    I combined Digital clock and temp display into one unit. They work great. Both projects are from this site. Take a look at the picture and read 1st post of this project, you should be able to figure out the parts. Good luck
     

    Attached Files:

  18. kchriste

    kchriste New Member Forum Supporter

    Joined:
    Jul 23, 2006
    Messages:
    3,677
    Likes:
    47
    Location:
    Victoria BC, Canada
    That's a nice looking PCB Sananh! Can we see the foil side? What are the LEDs in the upper right hand corner for?
     
    Last edited: Nov 20, 2008
  19. Space Varmint

    Space Varmint New Member

    Joined:
    Jul 10, 2008
    Messages:
    1,487
    Likes:
    11
    Location:
    Tucker GA...USA
    I don't know, but it's nice :) Good job!
     
  20. sananh

    sananh New Member

    Joined:
    Oct 13, 2007
    Messages:
    6
    Likes:
    0
    Better pix

    Here are couple better pictures. It's a single side PCB so I couldn't etch all traces on PCB I have to use soldering iron and wires to finish it up.
     

    Attached Files:

  21. Mike - K8LH

    Mike - K8LH Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    3,641
    Likes:
    109
    Location:
    Michigan, USA
    sananh,

    Very nice job Sir.

    I wonder if your regulator gets hot? When I tried using a standard 7805 regulator it got extremely hot (it was being supplied by a 15v wall wart) so I built and use a little 5v/1a smps regulator based on the Micrel MIC4575.

    Regards, Mike
     
    Last edited: Nov 26, 2008
Thread Status:
Not open for further replies.

Share This Page