Module 1: Overview of Mechatronics: Lesson 1: Microcontrollers, Microprocessors, and Embedded Computers
Module 1: Overview of Mechatronics: Lesson 1: Microcontrollers, Microprocessors, and Embedded Computers
1. What is a Microcontroller ?
A microcontroller is a miniaturized compuer containing a processor core, memory and input-
output peripherals in a single integrated circuit. In short, it is small computer designed for
embedded applications.
Unlike microprocessors which are designed for computers, microcontrollers are designed for
embedded applications. It is different from microprocessor in that they include input-output
peripherals.
A micrcontroller unit is sometimes abbreviated MCU.
Embedded applications are fundamentally different from computers because computers are not
designed to do some other functions besides computation, so computers use microprocessors.
3. <MICROCONTROLLERS VS MICROPROCESSORS>
Comparing microcontrollers, microprocessors are little closer, one of the key characteristics that
makes microcontrollers different from microprocessors are:
5. Microcontrollers don't really run an OS in the same ways that microprocessors run
Windows, it only run the program that you supply to it.
6. Microcontrollers use a lot less power than microprocessors.
it's important for a lot of embedded advices because they run on batteries.
Key differences:
1. Microprocessor consists of only a Central Processing Unit, whereas Micro Controller
contains a CPU, Memory, I/O all integrated into one chip.
2. Microprocessor is used in Personal Computers whereas Micro Controller is used in an
embedded system.
3. Microprocessor uses an external bus to interface to RAM, ROM, and other
peripherals, on the other hand, Microcontroller uses an internal controlling bus.
4. Microprocessors are based on Von Neumann model, Micro controllers are based on
Harvard architecture
5. Microprocessor is complicated and expensive, with a large number of instructions to
process but Microcontroller is inexpensive and straightforward with fewer
instructions to process.
src: https://www.guru99.com/difference-between-microprocessor-and-
microcontroller.html#:~:text=KEY%20DIFFERENCES,all%20integrated%20into%20one
%20chip.&text=Microprocessor%20uses%20an%20external%20bus,uses%20an%20internal
%20controlling%20bus.
Embedded computers are the "middle ground" - part microcontroller, part microprocessor.
Embedded computers have some of the same input/output peripherals as a microcontroller
(digital output pins or serial communication devices) , but with a faster processor and more
memory.
Embedded computer are designed for real-time applications where more advanced
software/processing is needed (such as computer vision). They run OS
Embedded computers are usually more expensive than microcontrollers.
Example of some typical embedded computers are the Raspberry Pi or ODROID, which are used
in a lot of robotics applications
5. Elements of a Microcontroller
3. Memory
Microcontrollers have both volatile and non-volatile memory onboard:
6. Volatile Memory (Data memory) : Data is maintained in memory as long as power is
applied. If power is removed, data will be lost.
7. Non-Volatile Memory (Program memory): Data is maintained even when power is
removed.
This table shows a lot of detail about each of those different memory types, but the most
important are EEPROM or Flash Memory and static Ram (SRAM), these are the 2 most common
types of memory space you'll see on a microcontroller.
Flash Memory is the type of non-volatile memory where our program is usually stored and
where we can write data that we want to maintain even when power is removed from the
device.
Static Ram (SRAM) is a type of volatile memory , that's where our program usually stores data,
but data is lost every time power is removed.
Market analysis shows that over the past decade 8-bit MCU are roughly as popular as 32-bit
MCU, the reason is many embedded applications are simple and require minimal computation.
Cost and power considerations means 8-bit MCU is more desirable. For instance, a dishwasher
doesn't really do a lot of heavy computation.
Microcontroller is just a processor that looks like an integrated circuit with dozens of pins:
It is a small integrated circuit that looks like a little black IC package with a lot of pins, maybe
dozens of different pins.
Development Kit is a microcontroller on this breakout board that allows us to easily connect
wires to each of the microcontroller pins. The actual pins on the microcontrollers are really
small and hard to access with things like wires as we're doing testing and prototyping.
So that's what the development kit is for, for prototyping and ease of connectivity.
This is an close-up view of the MSP432 LaunchPad development board from Texas Instruments.
There's several key elements that are important:
12. There's a USB connection to a PC
13. There's header pins that allow us to connect GPIO pins or I/O pins, from the
micrcontroller to external devices such as sensors, motors, and servos etc amd also
power the micrcontroller from a battery quite easily
MSP432 microcontroller is a fairly high end microcontroller that allows us to do things like
sensor processing and filtering or driving servos.
1. General Purpose Input-Output
Micrcontroller contains numerous general purpose input-output (GPIO) pins that are used to
interface with external devices such as sensors, or servers. These pins exposed on development
kits (or Evaluation Modules) as headers, sometimes they're tied to buttons, or LEDs for
prototyping purposes.
Many pins on a MSP432 serve multiple possible purposes, the diagram below provided by Texas
Instruments shows the pin functionality for various I/O pins that are exposed on the header on
the MSP432:
The pin functionality can be configured between one of possible options during program
execution.
14. Shields (or TI BoosterPacks) are often available for MCU development kits that enable
easy integration between peripherals (e.g., sensors and motors) and GPIO pins.
15. Designed to fit on top of development kits without need for wires.
1. As soon as MCU boots up, it reaches into program memory (flash) and loads the first
instruction you programmed it with
2. So, your progam executes automatically everytime your microcontroller starts up
3. Your program continues to run until board powered off
4. Unlike typical PC, MCU does not run other background process/programs - it does nothing
except what you program it to do
Programming a microcontroller
16. Unlike PCs, you can't write code directly on the microcontroller
17. On a microcontroller, we have to write the actual code on a computer, and then use
some other type of device to place that program in the MCU flash memory
18. MCU must be connected to an external programmer for this to happen.
Here's an example of an external programming device availabel from TI that's
designed to program the MSP432
19. Many development kits (evaluation modules, EVMs) have on-board programming
capability, meaning they can be programmed from a computer. This is the nice part
about dev kits because we don't need the external programmer.
20. The MSP432 LaunchPad has what's called an onboard programmer, onboard emulator.
The purpose of the onboard emulator is to provide a USB connection to you computer
and to allow you to program the microcontroller chip directly from computer.
Furthermore, the emulator allows you to actually debug operation of your
microcontroller program also directly from your laptop.
2. Normal Operation
When we reboot the microcontroller, it operates in what's called the normal
operation. As we mentioned before, the first thing that happens is the ALU/CPU goes
and gets its first instruction from flash memory, executes it, and fetch the next
instruction, on through this loop during normal operation
Powering the MSP432
21. The MSP432 can be powered using the LaunchPad USB Interface with a computer
22. MSP is powered at 3.3V.
Jumper connections (red) provide power to MCU and header pins from USB
connection across "isolation block".
23. One key aspect of this diagram is that block in green. There's a little green rectangle that
denotes what's called the isolation block
24. The isolation block includes a group of jumper wires that really connect the onboard
emulator with the microcontroller (MCU portion of Launchpad to emulator portion),
between those 2 dash blocks on top and on bottom.
25. The red jumper are what connect power from the onboard emulator or the computer to
the microcontroller. So when the red jumpers are installed, the microcontroller can be
powered directly from computer. When the jumper is removed, the microcontroller
needs to be powered externally from a battery or a power supply.
26. To power the MSP432 from an external source (battery, power supply etc), remove the 2
red jumpers (3.3V jumper in isolation block) and provide 3.3V to the header pin marked
J1.1 and ground the jumper pin labeled J3.22 to an appropriate ground.