16 MHZ oscillator doubt

we say an oscillator of 16 MHZ.so one operations done at (1/16MHZ=)62.8ns.for example digitalWrite(13,HIGH).so 1,60,00,000 such opertaion can be done in a second this is what i am thinking that 16MHZ meant to be. am i right.

No, you could not do 16 million "digitalWrite"s a second - "digitalWrite" is a fairly long function, and takes a few microseconds (an oscilloscope would tell you how many, roughly). If you want to go really fast, google "port manipulation"

u mean i want to directly access the port instead of giving something like digitalwrite().is operations like (a=2+3) also took long timeand what are all some other long function that i want to know.Thank you in advance

is operations like (a=2+3) also took long timea

Because of the optimisations the compiler makes, it is hard to generalise (although "a=2+3" would almost certainly become simply "a=5"), but any expression is going to take multiple machine cycles to execute. The operands have to be fetched from memory, and if they're bigger than bytes, they'll have to be fetched one byte at a time, then operated upon, and again, if they're bigger than bytes, multiple-precision arithmetic will be required. Finally, the result needs to written back to memory. Any branching will typically consume multiple cycles.

You can look at the code generated by the compiler, and use the instruction set summary in the datasheet to see how much time typical sequences will take.

ohh.thank you.and actually i am newbie to arduino.i want to learn all the components which are in arduino board.(ALL THE COMPONENTS).so will you suggest me some pages where i can get detials of all the components.please.thank you


What you're asking isn't exactly straightforward to work out, since you'll be writing your code using the Arduino IDE which abstracts the underlying microcontroller instructions so you won't be able to tell just how your Arduino code is implemented at a machine instruction level.

If you're interested in a read, the AVR instruction set explains what's happening under the covers. There's a table starting from page 11 in that linked PDF which shows how many clock cycles per instruction. From there I guess you'd have to get a listing of your sketch in machine language to work out how many cycles, and therefore the time taken, to do your various operations.

Cheers ! Geoff

edit: not sure where those code tags came from!


There's really just 2 - the USB/Serial Interface chip, and the microcontroller. Then you've got some resistors, capacitors, LEDs, diodes, resonator, and a comparator which compares 3.3V against the barrel jack input voltage and controls a FET to use USB power when the barrel jack voltage is too low, and two voltage regulators; 5V and 3.3V. Look at the schematic for a board (see the Products page) and ask more specific questions if you have them. Datasheets for the Atmel chips can be found here. http://www.atmel.com/products/microcontrollers/avr/megaAVR.aspx

ALL THE COMPONENTS).so will you suggest me some pages where i can get detials of all the components

The "gold source" for any component is the manufacturer data sheet... However, this may totally over look how that product is being used in an Arduino board. For example, the 16U2 microcontroller is used to implement software to connect over USB - replacing the FTDI chip use in previous models.

For electronic components, a Google exercise will give zillions of references. But you can experiment with electronics without ever buying a single part: http://www.falstad.com/circuit/

Keep up the inquisiness.