====== Sitemap ====== This is a sitemap over all available pages ordered by [[doku>namespaces|namespaces]].
Page Actions
Wiki Actions
User Actions
====== Microcontroller concepts ====== Tiny computers surround your life. In your coffee maker, remote control, vacuum cleaner, telephone, and clock radio. Unlike your personal computer, where a central processor has a huge amount of processing power, these tiny computers are special purpose devices that have relative low performance requirements. These tiny computers are, in general, microcontrollers. Microcontrollers are getting more and more available to the general hobby-hacker through the advent of devices like the BasicStamp and the Arduino. ===== The difference of processors and controllers ===== A microprocessor is very generally speaking a processing device, with little to no supporting elements included on the device itself. Reduced to the basic microprocessor concept, it will be a device with an instruction set, controlling registres, general registers and processing units like Arithmetic Logic Unit (ALU), and finally external connections in form of data bus, address bus and interrupt pins. A microprocessor requires external component to implement memory (RAM), storage (ROM, FLASH) and for interfacing with I/O of various forms. A microcontroller integrates a microprocessor with several supporting elements in the same package. A microcontroller will typically include RAM, ROM and commonly FLASH memory, as well as I/O interfacing (digital ports, A/D converters, timers, PWM generators, serial UART) in a single package. The full data and address busses of the microprocessor is commonly not available as pins on a microcontroller. Instead, interfacing is done though the integrated I/O ports. The microprocessors can be constructed as very high-performance parts, and their nature is a very generalised one, allowing the microprocessor to be used in complex systems, or built into very special purpose ones. This generic nature means a microprocessor-based system will require many supporting systems physically external to the processor itself. These externals may be of very high-performance and may even be to some extent autonomous, offloading processing from the processor. This naturally comes at the cost of complex physical and electrical constructions. Compared to this, the microcontroller is typically relatively low-performance, and has a reduced and sometimes specialized instruction set. This is offset by the fact that a lot of I/O interfacing and supporting functionallity is built into the same package as the processing core. This allows for compact, simple physical and electrical designs, but limits the practical use of microcontrollers to embedded systems, and specialized control systems. Microcontrollers are excellent devices to use in control-systems because of their I/O bound nature, low parts count and realtive low price. When looking to construct a general-purpose and/or high-performance system, you are probably looking at using a microprocessor. On the other hand, when developing a dedicated control system, you will probably be using a microcontroller, and by that, reducing development time, complexity and cost. ===== Families of microcontrollers ===== There are several families of microcontrollers. Typically, each family has a limited, most often one, manufacturer, and this manufaturer is most often the original developer of the controller family. The most commonly used controller families in embedded hobby electronics are as far as I can tell: ==== AVR ==== {{ :guides:atmega168.jpg?100}} Developed by Atmel, the AVR family is a quite popular modified Harvard architecture 8-bit RISC. The AVR architecture was conceived by two students at the Norwegian Institute of Technology (NTH) Alf-Egil Bogen and Vegard Wollan. AVR microcontrollers are today split in a set of (8 bit) sub-families: * **tinyAVR**\\ the ATtiny series, limited peripheral set * **megaAVR**\\ the ATmega series, extended instruction set, larger program memories, extensive peripheral set * **XMEGA**\\ the ATxmega series, extended performance features, such as DMA, "Event System", and cryptography support, extensive peripheral set with DACs * **FPSLIC**\\ AVR with FPGA ==== PIC ==== {{ :guides:pic18-150-40-dip.jpg?150}} The PIC family is very popular among hobbyists and industry developers alike, and has a wide variety of devices with varying interfaces and capabilities. These microcontrollers are supplied by Microchip, who currently holds the patents and trademarks for PIC technology. Like AVR, PIC is based on a Harvard architecture, where code and data space is separated. The PIC technology derives from the PIC1640 originally developed by General Instrument's Microelectronics Division. The name PIC initially referred to "Programmable Interface Controller" PIC controllers are available in several families: * **PIC10**\\ 8 bit architecture, 10 bit code-space, low pincount, low performance * **PIC12**\\ 8 bit architecture, 12 bit code-space, typically low pincount * **PIC16**\\ 8 bit architecture, 14 bit code-space, versatile and commonly used * **PIC18**\\ high-performance 8-bit architecture with 16 bit code-space. Quite a lot of developers who used PIC16 previously is now moving to PIC18. * **PIC24 and dsPIC**\\ 16 bit architecture, high performance devices. Mulitple registers make them very powerful compared to 8-bit PIC's * **PIC32**\\ These differ from previous PIC's by being Von Neumann devices, not Harvard. A leap up from PIC24, they 32 bit devices with very high MIPS and capabilities. The first sets of PIC32 devices are pin-compatible with PIC24. ==== ARM ==== {{ :guides:lpc214x_chip.jpg?150}} The ARM is a 32-bit reduced instruction set computer architecture developed by ARM Holdings. It was known as the Advanced RISC Machine, and before that as the Acorn RISC Machine, and initially comes from a microprocessor for desktop computers produced by Acorn Computers. The ARM architecture is provided as a series of versions and sub-families, and the ARM7/Cortex-M3 is the one typically integrated in ARM based micro-controllers. Being native 32-bit devices, they have a computational performance edge over other microcontrollers, where 8 and 16 bit is the norm. However, the programming principles of the ARM, like pipelining and unfamiliar instruction set are often seen as obstacles compared to the relatively simple programming of other, simpler devices. ARM microcontrollers are provided by several manufacturers, most notably: * **Altera**\\ Supplying FPGA's with ARM cores * **Freescale**\\ The MAC7100 family of controllers geared towards automotive use * **Philips/NXP**\\ Most notable microcontroller are the LPC2000-series ARM based, high performance, high-memory devices. Highly rated, but I am told they are not trivial to develop for. Personally, I have no experience working with ARM-based microcontrollers. If you have information fitting this section that you would like to have added, please contribute by registering and editing, or simply send me an email... ==== STM ==== STMicroelectronics produce 8-bit microcontrollers, and their ST6/7 controllers are common in appliances like washing machines, and the ST8 32-bit memory devices are used in sensing and safety systems. Personally, I have no experience with these, and I have not seen much use of ST controllers in hobbyist designs. ===== Development boards ===== {{ :guides:picdem2-plus.jpg?150}} Learning to use a new type or family of microcontroller can be limited severely by the fact that the device is unfamiliar to the developer, so the design of a circuit to use the device becomes difficult. Learning how to program and use a controller is often a crucial step in learning to use and interface to a given controller, and commonly you want to start experimenting with code and interfacing before committing to designing a special purpose design. The controller manufacturers realize this, and produce demo boards, evaluation kits and trainers for their microcontrollers. These boards include all supporting circuitry needed, and facilitate rapid prototyping and experimentation, allowing rapid learning of a controllers features. Third-party manufacturers, like Olimex, also create development boards, both special- and general-purpose for the variety of microcontrollers. These third-party development boards often combine microcontrollers with other circuitry, like sensors or I/O level converters, or allow demonstration of advanced usage, like Ethernet connectivity or wireless communication. {{ :guides:arduino.jpg?150}} Demo-, prototype- and evaluation boards are a good way to rapidly get experience with controllers and peripherals without having to invest in complex circuit design and production. A very prominent example of how a prototype-kit can make microcontroller-oriented development very easily available, is the Arduino platform. The Arduino has opened up Controller-based systems to an enormous audience, who without the Arduino would not consider developing. A downside to this, is that systems tend to be centered around the prototype-platform (Arduino) rather than being more efficiently built directly around the microcontroller (Atmel Atmega AVR).