---- Original message ---- >Date: Tue, 24 Sep 2002 15:05:13 -0700 >From: Matt Johnson >Subject: Re: [PIC] Stupid Question >To: PICLIST@MITVMA.MIT.EDU > >Jinx, > >Holy cow! Thanks a lot this is everything I wanted to know and more. I >didnt know any of that about the crystals. I have a couple questions >related to that. > >1. Does the code syntax change depending on the crystal speed? it seems >like if it didnt why wouldnt you just always use the fastest one, the >price differences seem minimal. Only the timing of the execution of the code changes when you change oscillator speeds. If your code includes anything time-related (which it almost certainly would), then it would need altered to reflect the new oscillator speed. Peripheral devices (A/D converters, watchdog timer, etc.) do not usually use the same clock, and their timing may not be affected. In this case, more drastic code changes may be needed to accomodate these devices at a different oscillator frequency. >2. Are there any internet resources that explain more about a hexadecimal >value crystal vs. a decimal value crystal? I have a problem understand how >a crystal that emits frequencies would have anything to do with binary or >decimal, I would like to know more about that. Serial communications (and many other functions) must occur at certain time intervals. Timing with microprocessor code is quantized -- you have to work in multiples of the clock period (or 4X the clock period, for PICs). Therefore, if you want to do serial communications at a certain speed, it is easiest to choose an oscillator with a frequency that is an even multiple of the communications data rate. >3. Ceramic Resonators, I imagine when you talk about accuracy you are >referring to the fact that a clock cycle varies in the time it execute? so >basically this only matters when you need accuracy within milliseconds and >consistantly correct? Accuracy is specified as a percentage, and exactly what time error that turns out to be depends on the interval. For example, a 10% error on a 100ms interval is 10ms. On a 1 day interval, it's 2.4 hours. Accuracy varies not only from resonator to resonator, but also with temperature and possibly other variables for a given resonator. If your application is time critical, you will need to determine how much clock frequency error is allowable and under what circumstances -- then you can choose a clock source. >BTW, I have been considering if I should get into the PICs or the AVRs, >and from my initial emails it appears that I get a lot more support from >the PIC users than the AVR. I wonder why if the AVR's are faster and >'better' overall why the support base is so skewed towards PIC users... PICs are more common and there are more development tools for them. I get the impression that microchip is friendlier, if that matters. AVRs are overkill for most applications -- if a PIC works, why bother with something more powerful? -- Mike P. MTP Technologies KC0LLX -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads