microcontroller thread #3

Discussion in 'General Science & Technology' started by cato, Jul 19, 2006.

Thread Status:
Not open for further replies.
  1. cato less hate, more science Registered Senior Member

    Messages:
    2,959
    yeah, I read that part, but I don't really know what is best to use.
     
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. MetaKron Registered Senior Member

    Messages:
    5,502
    Try 10k and 180 pF. 220 pF, 330, 470, somewhere in there. Maybe try 4.7 k for the resistor, up to 20 or 30 k.

    If you have a frequency counter you can get the frequency from the pin that says OSC/4 if it is in the right mode.
     
    Last edited: Aug 14, 2006
  4. Google AdSense Guest Advertisement



    to hide all adverts.
  5. cato less hate, more science Registered Senior Member

    Messages:
    2,959
    hmm, I guess. I have a program to measure frequency (from my class). but it is a huge pain to write a monitor program for the chip, just to know the frequency. I would not even know how to do it since the monitor program I did before used hyperterminal.

    do you know of of any other way I could make sure I have the right frequency? I guess I could wait till school starts, and use the oscilloscope.
     
  6. Google AdSense Guest Advertisement



    to hide all adverts.
  7. MetaKron Registered Senior Member

    Messages:
    5,502
    I think that the biggest problem you will have is not knowing the exact timing of your processes. When you can, it is a good idea to invest in some crystals. Doesn't your school have a frequency counter, by the way?
     
  8. cato less hate, more science Registered Senior Member

    Messages:
    2,959
    yeah, our osciloscopes kick ass. they can do pretty much anything you want, and take a color image and save it if you like. if I want duty cycle, no prob, frquency, no prob. I can even plot two different inputs with respect to eachother (one probe is y-axis, other is x-axis) if I want.

    yeah, you are right, I could just shoot for like 10MHZ or somthing, so my margin of error wont make much dif. besides, its not like the first couple of things I do will need a perfect clock.
     
  9. cato less hate, more science Registered Senior Member

    Messages:
    2,959
    forget it, I am just going to get a crystal. I found an electronic store I can get one from.
    http://www.alliedelec.com/Search/SearchResults.asp?SearchQuery=crystal 20 mhz&SearchType=STANDARD
    I was thinking I would get the third one in that list. it says on the main page that it is a 20MHz oscilator, but in the data sheet it lists a range. forgive me for not knowing much about crystals, but do the caps regulate the frequency? and if so, is there a way to calculate exactly what values of the caps I need?
     
  10. invert_nexus Ze do caixao Valued Senior Member

    Messages:
    9,686
    It looks to me like the specific crystal there is 20 MHz. The frequency range is given for the product line in general, the XT49U line. But, when you buy one, you have to have a specific frequency and other specifications.
     
  11. cato less hate, more science Registered Senior Member

    Messages:
    2,959
    ohh, ok
     
  12. cato less hate, more science Registered Senior Member

    Messages:
    2,959
    updated schematic:

    Please Register or Log in to view the hidden image!



    let me know if I messed something up. besides the short across the cap, I already fixed it.
     
  13. MetaKron Registered Senior Member

    Messages:
    5,502
    Cato, on a breadboard it is a good idea to keep the frequencies down, so you might want a 4MHz crystal. You can program the chip to multiply the crystal frequency by 4, so when you are ready you can use a 10 MHz crystal. It is a smaller pain.

    Parallel versus series resonance means that the crystal was calibrated for either a capacitative or an inductive load when it was made. I think that the documentation of those crystals implies that they use capacitative loading but I am not sure. You might want to log on to the manufacturer's site and see if you can find a better explanation.
     
  14. cato less hate, more science Registered Senior Member

    Messages:
    2,959
    yeah, thanks man, I didn't even think of the frequency problem. yeah I will go with 4mhz. would the crystal's package list whether it is parallel (cap) or series (L)? or would that be in the data sheet?

    anyway, I should be able to get this mofo up next weekend. after the led "hello world" flasher, what other simple shit can I do. maybe I can learn some ADC or somthing.

    later
     
  15. MetaKron Registered Senior Member

    Messages:
    5,502
    I really don't know. Crystals labeled "microprocessor" crystals are very likely to be parallel. It's a matter of the calibration according to some literature I read, There doesn't seem to be explicit labeling in the data sheets about the parallel versus series thing. Look at the loading they specify. Two capacitors of equal value in that pi configuration you showed me add up to half of that value, so you can add them up to the capacitative loading on the sheets. Try for one that says 15 to 18 pF and then the two 30 or two 33 pF capacitors will give you a value that is close enough.

    For the most part you will never know the difference anyway, but with frequency counters you will need to make an effort to get that timing calibrated. You can make one of the caps a variable for that.
     
  16. leopold Valued Senior Member

    Messages:
    17,455
    capacitors are notorious for having extremely wide tolerances.
    -25% to +50% is typical
    your best bet in this situation is to have a variable cap in series with one of the others to tweak the frequency. also make sure your supply voltage is regulated and that no stray capacitances is being coupled to your clock.
    timing problems will definately be the biggest problem you will face in digital design. there are others of course, addig with carry instead of a straight add will drive you bananas tracking down the cause.
    do you have a logic probe? if not get one, it's a good investment.
     
  17. MetaKron Registered Senior Member

    Messages:
    5,502
    Even without tweaking the calibration the clock should still be pretty accurate. There are all sorts of ways, including synchronizing with the WWV time signal if you have one. Can't do that over the net because of unpredictable delays.
     
  18. cato less hate, more science Registered Senior Member

    Messages:
    2,959
    what?
     
  19. MetaKron Registered Senior Member

    Messages:
    5,502
    The two little capacitors next to the crystal present their capacitance to the crystal in series.
     
  20. cato less hate, more science Registered Senior Member

    Messages:
    2,959
    this is what I don't get. one what? crystal? what do you mean "says" says where? in the 18f458 data sheet?

    its like a riddle =]
     
  21. MetaKron Registered Senior Member

    Messages:
    5,502
    Your schematic up the page here. To figure out the approximate capacitative loading that you have on the crystal, figure out the total of the two capacitors in series.
     
  22. cato less hate, more science Registered Senior Member

    Messages:
    2,959
    I guess I just don't understand why I need the total. the 18f458 data sheet tells me what caps to use for what xtal.
     
  23. MetaKron Registered Senior Member

    Messages:
    5,502
    I was thinking that it helped to know that if you wanted to make one a variable to trim the frequency.

    The crystal is calibrated for a certain capacitative load so I think if you aim for that much when using a variable in the circuit, that puts its rated capacitative load in the center of the adjustment range of the variable capacitor.
     
Thread Status:
Not open for further replies.

Share This Page