the hardware hacker\'s introduction to microcontrollers, part one: anatomy of an arduino
First of all, the micro-controller is not a simple thing, so don\'t be discouraged if you feel it is important --boggling!
The world of micro-controllers is fascinating, engaging, and an awesome hobby;
It will never get bored.
I will focus more on micro-controllers based on I/O and simulation, such as micro-controllers running Arduino, and take the Atmel chip as an example (
These are the most commonly used and easy to program.
What is a micro controller?
The micro-controller is a silicone
Based on computer chips (
, Programming with a set of instructions.
These instructions can go from simple flashing LED to processing a large amount of data from a serial connection.
The size of the micro-controller usually depends on the number of pins and flash memory.
For beginners, I recommend to buy Arduino Duemilanove as it is cheap ($30)
Very easy to use.
Advanced Microprocessor users usually write programs in C, and then compile the completed script into hexadecimal (hexadecimal)format.
Finally, the serial cable and (or similar)
Programming software where users write or flash data to the chip itself through the SCK, MOSI, MISO, and reset pins of the micro-controller (
Called SPI, or Serial Peripheral Interface Bus).
In the case of Arduino, the ATmega chip on the motherboard itself contains a \"boot loader\" that understands and program the data through a serial port, it is basically the telephone line between the computer and the motherboard, and the boot loader is the interpreter and the recorder.
Small silver rectangle (rounded edges)
Is a quartz crystal oscillator that produces frequency (
16 MHz in this case).
In order to achieve accurate serial communication, the external oscillator is feasible.
As mentioned earlier, the micro-controller without the boot loader must be programmed via SPI.
All micro-controllers (
At least Data Sheet)
There is a pin schematic and pin description.
For example, here are the pins and descriptions of the ATmega328 described above.
VCC is a positive power input (5V)
GND is negative (or ground).
The SPI uses pins 17, 18, and 19 to program the chip if it does not have a boot loader.
The digital pins can provide I and O interfaces at the same time, in other words, they can output power (ex. light an LED)
, Or receive power (ex.
Identify if the switch is in a high or low state/on or off).
The analog pins are more complex because they collect multiple forms of data in a large range of voltage readings.
For example, the analog pin can determine the \"digital\" specific voltage of the input. The AREF pin (
21. simulation reference)
Used as a maximum or measured value represented by a numeric value of 1023.
Any value between 0 and the reference voltage is represented by a value between 0 and 1023.
WarningsNow, go into Part 2 and get an insight into the mysteries of the micro-controller programming!