What is the difference between an Arduino, a microprocessor, and a microcontroller? I'm trying to determine what is best to operate a cheap resistive touch screen.
Electronic – Arduino vs Microprocessor vs Microcontroller
arduinomicrocontrollermicroprocessorterminology
Related Solutions
A microprocessor generally does not have RAM, ROM and IO pins. It usually uses its pins as a bus to interface to peripherals such as RAM, ROM, Serial ports, Digital and Analog IO. It is expandable at the board level due to this.
A microcontroller is 'all in one', the processor, ram, IO all on the one chip, as such you cannot (say) increase the amount of RAM available or the number of IO ports. The controlling bus is internal and not available to the board designer.
This means that a microprocessor is generally capable of being built into bigger general purpose applications than a microcontroller. The microcontroller is usually used for more dedicated applications.
All of these are very general statements. There are chips available that blur the boundaries.
I learned on a 68HC11 in college. They are very simple to work with but honestly most low powered microcontrollers will be similar (AVR, 8051, PIC, MSP430). The biggest thing that will add complexity to ASM programming for microcontrollers is the number and type of supported memory addressing modes. You should avoid more complicated devices at first such as higher end ARM processors.
I'd probably recommend the MSP430 as a good starting point. Maybe write a program in C and learn by replacing various functions with inline assembly. Start simple, x + y = z, etc.
After you've replaced a function or algorithm with assembly, compare and contrast how you coded it and what the C compiler generated. This is probably one of the better ways to learn assembly in my opinion and at the same time learn about how a compiler works which is incredibly valuable as an embedded programmer. Just make sure you turn off optimizations in the C compiler at first or you'll likely be very confused by the compiler's generated code. Gradually turn on optimizations and note what the compiler does.
RISC vs CISC
RISC means 'Reduced Instruction Set Computing' it doesn't refer to a particular instruction set but just a design strategy that says that the CPU has a minimal instruction set. Few instructions that each do something basic. The is no stringently technical definition of what it takes 'to be RISC'. On the other hand CISC architectures have lots of instructions but each 'does more'.
The purposed advantages of RISC are that your CPU design needs fewer transistors which means less power usage (big for microcontrollers), cheaper to make and higher clock rates leading to greater performance. Lower power usage and cheaper manufacturing are generally true, greater performance hasn't really lived up to the goal as a result of design improvements in CISC architectures.
Almost all CPU cores are RISC or 'middle ground' designs today. Even with the most famous (or infamous) CISC architecture, x86. Modern x86 CPUs are internally RISC like cores with a decoder bolted on the front end that breaks down x86 instructions to multiple RISC like instructions. I think Intel calls these 'micro-ops'.
As to which (RISC vs CISC) is easier to learn in assembly, I think its a toss up. Doing something with a RISC instruction set generally requires more lines of assembly than doing the same thing with a CISC instruction set. On the other hand CISC instruction sets are more complicated to learn due to the greater number of available instructions.
Most of the reason CISC gets a bad name is that x86 is by and far the most common example and is a bit of a mess to work with. I think thats mostly a result of the x86 instructions set being very old and having been expanded half a dozen or more times while maintaining backward compatibility. Even your 4.5Ghz core i7 can run in 286 mode (and does at boot).
As for ARM being a RISC architecture, I'd consider that moderately debatable. Its certainly a load-store architecture. The base instruction set is RISC like, but in recent revisions the instruction set has grown quite a bit to the point where I'd personally consider it more of a middle ground between RISC and CISC. The thumb instructions set is really the most 'RISCish' of the ARM instruction sets.
Best Answer
A microprocessor:
is typically found in a desktop PC or laptop and contains a CPU and an external memory interface plus various I/O buses to connect to the outside world such as SPI, I2C, UART, USB, LCD and others. A microprocessors will also have an external crystal to provide a clock.
Most microprocessors have no read-only memory on the chip; instead there is an external chip on the motherboard where the initial boot code is located. On Intel-based PC's, this is called the Basic Input/Output System (BIOS) and also contains I/O routines in addition to the initial boot code. The boot code starts by doing a Power-On Self Test (POST) and then looks to see where to load the next stage of the boot code -- from a hard drive, CD (or in olden days) a floppy disk. This second level boot then loads the operating system. (There may even be three levels of boot code in some systems.)
Some microprocessors (usually ones targeted for smart phones and tablets, which have limited boot options) have a small amount of read-only memory that contains the initial boot code.
I refer to the boot code as read-only; actually on some systems, it can be updated. However this is fairly risky; if something goes wrong the system may no longer boot.
Unlike microcontrollers, which execute their programs out of read-only memory, after booting up microprocessors load their programs into external RAM and execute it from there.
A microcontroller:
on the other hand is a standalone single-chip IC that contains a CPU, read-only memory to store the program, RAM to store variables used in the execution of the program, and various I/O buses to connect to the outside world such as SPI, I2C, UART and others. By itself, it cannot execute any programs without being programmed via an external interface to a PC. A microcontroller may also need an external crystal to provide a clock, however some have an internal clock.
Some microcontrollers (such as Microchip's PIC32) have two sections of flash memory; one to hold initialization (boot) code, and another to store the application. This makes it easier to update the application code in-place.
For your purpose, you would want to use a microcontroller, not a microprocessor. To use a microcontroller, you would either have to design your own board, or buy some sort of development board.
An Arduino:
is such a board, and contains a microcontroller, typical an 8-bit AVR such as the ATmega8, ATmega168, ATmega328, ATmega1280, and ATmega2560, plus power supplies, crystal, and female headers to interface with various peripheral boards.
These peripheral boards are called shields, and are designed to stack on top of each other (there are male pins on the bottom of the boards to connect to the Arduino itself or another shield, and female headers on the top to accept the male pins of a shield stacked on top of it).
Example shields are motor control boards, general I/O boards, relay boards, Ethernet boards, and LCD's, typically with a touch-screen. However I don't know of any resistive touch screens that would be used just for detection (without an LCD).
In addition to the hardware described above, Arduino also come with a cross-platform Integrated Development Environment (IDE) written in Java. It was designed to introduce programming to artists and other beginners, much as the BASIC language did 50 years ago. A program for Arduino is called a sketch.
Arduino programs are written in C or C++, however many of the details are hidden from the user: only two functions (called by the system) need to be defined to make a program that continually loops (which is typically for embedded programs)
The IDE comes with a software library called "Wiring" which can be used for common input/output operations.