Continue to Site

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.

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

K8LH Novelty Single Chip Clock

Status
Not open for further replies.
What a horrible piece of code and it uses Timer0. If you do a search Mike (the OP) posted a very good method to adjust for crystal inaccuracies in software.

Mike.

I don't see it. Mind pointing that out? What's the matter? Don't like assembler?
 
What on earth is this all about. Everyone is free to program in the language of his or her choice.

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

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. ;)
 
I don't see it. Mind pointing that out? What's the matter? Don't like assembler?

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

There you are. I'm glad you didn't get banned. There was talk in ****-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.
 
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.

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

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:
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;

If you do a search Mike (the OP) posted a very good method to adjust for crystal inaccuracies in software.
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:
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 ;) .
 
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?

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:
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
 

Attachments

  • PB100004.JPG
    PB100004.JPG
    165.1 KB · Views: 1,125
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:
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

I don't know, but it's nice :) Good job!
 
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.
 

Attachments

  • PB210002.JPG
    PB210002.JPG
    770.6 KB · Views: 988
  • PB210004.JPG
    PB210004.JPG
    667.4 KB · Views: 950
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:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top