ok i have worked out how to program these chips etc, and noticed that once programmed they will operate in a circuit correctly with the only other needed component being a 16 MHz oscillator between XTal1 and XTal2 as indicated by diagram. can someone explain to me why this oscillator is so critical, and what it is doing to enable it. i just like to understand things, im not being annoying simply for the sheer fun of being arduidiot.
The external X-tal is there for you for choose a "precition" (up to 20Mhz at 5V)
U can, of course, select the internal osc. at approx 8MHz by programming the internal 'fuse settings'.
This way the chip av run 'standalone'
A microprocessor needs a clock (oscillator) because it performs operations sequentially step-by-step, and the clock is the basis for the steps.
The clock needs to be accurate for serial communications, and so that clock operations such as millis() are accurate.
Where I work we have two different versions of a board, one with RS-232 and another one with parallel communications. They use different crystals. The serial version won't work with the wrong crystal, but the parallel version will. The parallel version normally uses a faster crystal, and it simply runs a little slower with the wrong crystal installed... You'd probably never notice...
You also need decoupling capacitors on the Vcc and AVcc supplies or the chip
can malfunction at random. Decoupling is mandatory for digital logic.
The Atmel chips can be programmed to run on an internal RC oscillator, freeing up
the Xtal pins as general I/O, but this is seldom done as the RC oscillator is not
very stable compared to a crystal.
ok thanks much appreciated especially RE the decoupling capacitors MarkT
This application note will come in handy also.
great thanks so we can immeadiately know something about a chips processing speed by looking at what frequency crystal is used to "keep count" so to speak. Ive noticed some specify the value of their frequency to differing significant figures eg for one of the modem card from a PC has one at something like 27.38 where as others will just flat out say 11 or 16. is this just a matter of designer preference?
16 MHz crystals usually have 16.000 printed on them.
Take a look at this datasheet that came up on google.
On the second page you have tolerances and stability data (30 and 50 ppm).
When it's stated 27.38 someone really wants you to use 27.38 for a specific reason.
When someone says 16, it's the same as 16.000.
arduidiot:
can someone explain to me why this oscillator is so critical
Actually it's not. This is why arduinos typically only have a ceramic resonator undertaking this task. It's only critical if you the timing of your code is critical.
Serial input and output will be based on this clock but even this has quite a bit of latitude.
well as a programming success signal ive got it on a random 0 to 400 delay pattern for a "pin operating correctly" indicator and noticed in this particular case i can get away with only a 16 MHz crystal so yea i guess timing there is as critical as it gets.
after reading some of the material you guys provided it seems i didnt encounter the problems the decoupling capacitors prevent because i wasnt handling a very inductive load
right and 4.7 kohms to reset
arduidiot:
well as a programming success signal ive got it on a random 0 to 400 delay pattern for a "pin operating correctly" indicator and noticed in this particular case i can get away with only a 16 MHz crystal so yea i guess timing there is as critical as it gets.
Sorry this just went right over my head. I don't suppose it helps that I've had some alcohol (it is xmas after all). Are you saying that your "random" value is critical
haha no im saying that the timing or "speed" at which the chip keeps count is going to be important in taking random analogue samples in time if the crystal is critical im just trying to write the bare basic circuits the chips need tom functions as in the datasheets but its ok i have enough reading material now
ah figure 5.1 in design considerations says alot
and the equations just below it give a way of being able to write a sketch that "checks" the "health" of the micro chip's function right? ah and thats why i see so many configs with at least one in the picofarads range
The crystal speed really comes into play when interfacing with the outside world.
If you look at the Serial section of the datasheet, you will there is list of clock speeds and UART register settings that will yield good serial results. So the crystal selected is often driven by that.
If you look at the Uno, there is a crystal that is used with the USB interface - not a resonator. So accurate speed there is critical. A resonator is used with the '328P and '2560 for serial speeds, as the settings for 9600 to 115200 bps are a little more forgiving than 12 Mbps with the USB interface.
how much more rugged is the 2560 with the screw in shield? ill be happy when im good enough to find and fix my original 2560.
mind you when i was working and money was like (well i didnt care as much as during my student only phases)so the amount of abuse it DID withstand prior to its downfall is a testiment to its design in a massive way and im talking about me exploring transformers and inductors when i had no clue what so ever so yea it really got hammered but still works with a DC jack. unreal!
oh, and btw if you look up the list of things someone has made that will kill your arduino my original 2560 had at least 5 of those things done to it daily for at least 4 months straight and it is "dead" now but wow every day shorted and sometimes just left that way for extended periods.. perfect analog readout all 16 when compared to multimeters until day of death at which it just said no im not turning back on this time