Shop OBEX P1 Docs P2 Docs Learn Events
Decimal clock so close - Page 2 — Parallax Forums

Decimal clock so close

2»

Comments

  • jcbarberjcbarber Posts: 37
    edited 2007-01-08 15:49
    I'm using my Parallax USB oscilloscope to measure the frequency. I find some capacitors and let you know

    JCB
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2007-01-08 17:03
    Another issue with the CD4060 oscillator is the method of mounting. If it is plugged into one of those white breadboards, those load down the oscillator pins in a way that might affect the oscillation. In such cases, people often bend the oscillator pins (10 and 11) straight up, not plugged into the breadboard, and fasten on the feedback components using dead bug wiring.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • jcbarberjcbarber Posts: 37
    edited 2007-01-08 18:09
    Tracy
    I have the chip in a breadboard so that may be the issue. I'm using a 33 pF cap from pin 11 to ground and a 15 pF from pin 10 to ground and I don't see any change in the frequency even if I flip them. What is "dead bug wiring"?

    JCB
  • allanlane5allanlane5 Posts: 3,815
    edited 2007-01-08 18:10
    "Dead bug" wiring is glueing the IC upside down to something, then wiring directly to the pins. When done this way, the IC looks like a "dead bug" waving its feet in the air -- thus the name.
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2007-01-08 18:26
    Alan is right about the dead bug wiring, but in your situation, I would only "dead bug" two of the pins, and it is okay to leave the rest plugged into the breadboard. Lifting a pin off the baord is considered a respectable way to wire a circuit, even in production, if the stray capacitance or leakage is a primary consideration. For example, you will always find the sense pin in ionization smoke detectors lifted off the board and soldered directly to the electrode.

    The trouble in the breadboard is that the springs add about 50 to 100 pf of capacitance in parallel with the crystal itself.

    For measuring the frequency, use the COUNT command on the stamp. It will be at least as accurate as the 'scope and a crosscheck on the result.

    result VAR Word
    DO
       COUNT 0,1000,result
       DEBUG ? result
       NAP 6
    LOOP
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • jcbarberjcbarber Posts: 37
    edited 2007-01-08 18:37
    Tracy
    At pin 14 on the CD4060 running the program you gave shows 25 on the debug screen at pin 1 it shows 7's and 6's

    JCB
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2007-01-08 18:48
    Okay, how about pin 9? That should be the oscillator output and should be solid 25600.

    The result from pin 1 makes sense, because 25600/4096 = 6.25 hertz, so you would expect between 6 and 7 counts. On the other hand, at pin 14 you would expect 25600/256 = 100 hertz, not 25. Are you sure you tapped the correct pin?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • jcbarberjcbarber Posts: 37
    edited 2007-01-08 18:53
    ooops!
    pin 15 gave 25 pin 14 gave 100 pin 9 gave 25593 and 25594
    JCB
  • jcbarberjcbarber Posts: 37
    edited 2007-01-08 19:27
    Tracy
    I tried the dead bug wiring on pins 10 and 11 and got the same results pin 1gave 6.66 Hz pin 15 gave 26.6 Hz. I guess this one is not going to work. I've learned a great deal and want to thank you

    JCB
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2007-01-08 19:48
    I think it probably is working. I am not familiar enough with the USB 'scope, but I think I would trust the result from the Stamp COUNT command more than I would trust a reading off the o'scope screen. The Stamp is showing close to 25600 oscillator frequency and probably the correct values at the other pins. 25593 is very close to 25600, less than 0.03% error. That is within the error bound of the Stamp resonator time base. You could tune the crystal frquency slightly with a variable capacitor, but you would need a more accurate time base for reference. You could let it run for a full day and compare it with you computer clock. Then put a correction factor into the PBASIC program. It should be quite accurate, at least at temperatures around room temperature at which those tuning fork crystals are relatively flat.

    Change the Stamp program to read period instead of frequency, and test pin 14 again...

    result0 VAR Word
    result1 VAR Word
    DO
       PULSIN 0,1,result0
       PULSIN 0,0,result1
       result0=(result0/500)+(result1/500)   ' units of 2uS, convert to milliseconds
       DEBUG ? result0
       NAP 6
    LOOP
    



    On the pin14 output, that should measure a period of result0 = 0.16 second. (Using a BS2, right?)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • jcbarberjcbarber Posts: 37
    edited 2007-01-08 19:53
    Tracy
    Thanks again for all the help. I need to leave for a few hours. I'll try the new stuff when I get back and let you know how it turns out.

    JCB
  • jcbarberjcbarber Posts: 37
    edited 2007-01-09 18:37
    Tracy
    I set up you program to get the period and from pin 1 I got 160 (.16 sec). I just added the code you suggested using XOR and AND to count time and I'll check it periodicaly durring the day and see haw it does

    JCB
  • jcbarberjcbarber Posts: 37
    edited 2007-01-09 19:36
    After 1 hour the clock is looking good. I think Tracy has given me that break through I needed! I'll continue with testing.

    JCB
  • jcbarberjcbarber Posts: 37
    edited 2007-01-10 16:56
    Well thank you everyone that helped. The decimal clock works!

    JCB
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-01-10 17:26
    Once it is completed (fully) you should post some pictures and possible code and schematics to the Completed Projects Forum. Congratulations.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • jcbarberjcbarber Posts: 37
    edited 2007-01-10 17:27
    I planned on doing that

    JCB
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2007-01-10 20:12
    It is a pleasure to see that you stuck with it and have had success. You are very welcome for the help! Did you say here, why you want to make a base 10 clock?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • jcbarberjcbarber Posts: 37
    edited 2007-01-11 16:18
    Tracy
    No I didn't. I wanted a clock (about 10 years ago) that would cause my Physics students to think. Most high school students want to know when class is almost over. With the decimal clock they would need to figure out how to convert from a base 10 clock to a 24 hour clock to find out what time it is (or memorize the time on the base 10 clock when the bell rings to let them out of class). I finally got around to doing it.

    JCB
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2007-01-11 18:55
    Ahh, my class begins at 5868 and ends at 6250?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
Sign In or Register to comment.