0% found this document useful (0 votes)
91 views

Module 1: Overview of Mechatronics: Lesson 1: Microcontrollers, Microprocessors, and Embedded Computers

The document provides an overview of microcontrollers, microprocessors, and embedded computers. It discusses that microcontrollers contain a CPU, memory, and input/output peripherals integrated into a single chip for embedded applications. Microcontrollers are designed for tasks like controlling sensors and actuators, while microprocessors are designed for general-purpose computing. Examples are also given of the MSP432 microcontroller, including its general purpose input/output pins that can be configured for different uses and how shields can be used to interface peripherals. Programming and executing code on a microcontroller is described as loading instructions from program memory on startup to run the programmed code in a continuous loop.

Uploaded by

Cereal
Copyright
© © All Rights Reserved
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
91 views

Module 1: Overview of Mechatronics: Lesson 1: Microcontrollers, Microprocessors, and Embedded Computers

The document provides an overview of microcontrollers, microprocessors, and embedded computers. It discusses that microcontrollers contain a CPU, memory, and input/output peripherals integrated into a single chip for embedded applications. Microcontrollers are designed for tasks like controlling sensors and actuators, while microprocessors are designed for general-purpose computing. Examples are also given of the MSP432 microcontroller, including its general purpose input/output pins that can be configured for different uses and how shields can be used to interface peripherals. Programming and executing code on a microcontroller is described as loading instructions from program memory on startup to run the programmed code in a continuous loop.

Uploaded by

Cereal
Copyright
© © All Rights Reserved
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 18

MODULE 1: OVERVIEW OF MECHATRONICS

TOPIC 2: INTRODUCTIONN TO MICROCONTROLLERS TECHNOLOGY

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.

2. What are Embedded Applications?


Embedded applications are some types of device or machine that use a computer in order to do
some calculations and give commands to things like actuators or sensors.
Some examples of embedded applications: dishwasher, thermostat, camera, microwave,
children's toys are considered embedded applications that use microcontrollers.

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:

1. The input-output peripherals that microcontrollers have on board.


These might include devices for communication with other microcontrollers (serial
communication), or devices to convert analog signals to digital signals, or digital logic pins
that allow microcontrollers to send command to actuator or receive binary information
(GPIO digial logic pins)

2. Microcontrollers have much slower clock rates than microprocessors do.


Typically, for microcontrollers, we'll see clock rates in megahertz range versus
microprocessors with clock rates in gigahertz range.

3. Microcontrollers have much smaller memory space than microprocessors.


We'll see memory space in kilobytes for microcontrollers, and modern microprocessor with
gigabytes range.

4. A lot cheaper than microprocessors

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.

4. <MICRCONTROLLERS VS EMBEDDED COMPUTERS>

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

Microcontroller is composed of 3 main elements, each of these 3 elements are combined on a


single chip and connected through some type of data bus that allows these elements to pass
information back and forth.
1. A central processing unit (CPU)
Microcontroller have a central processing unit (CPU) that executes program instructions.
CPU contains 3 main elements:
· Control Unit: Generates timing signal used to fetch program instruction from memory
and execute it. It's typically some type of clock.
· Arithmetic Logic Unit (ALU): Performs actual instruction on one or more pieces of data
(e.g., addition of 2 numbers)
· Registers: Memory location inside CPU, very close to the ALU, that hold internal data
while instructions are being executed

2. A set of input-output peripherals


GPIO allows us to interface the microcontrollers with other devices like a motor/servo/sensor.

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.

LESSON 2: MICROCONTROLLERS SPECIFICATIONS

1. MCU Register Size


What does it mean for a processor to be 8-bit or 32-bit ?
8. 8-bit or 32-bit refers to the word size of a processors
9. Word size is the size of the internal data registers used to perform computations
10. Larger word size means MCU can process more data at once
11. Example: Floating point (decimal) numbers are 32-bit, can only be processed by 32-bit
MCU

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.

2. MCU Development Kits

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.

To use an MCU for prototyping, it needs to be paired with a breakout board.

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

Let's look at some common micrcontroller development kits:


1. Arduino: a 32-bit microcontoller that's made by Atmel

2. STMicro: also 32-bit microcontroller


3. Clicker PIC18: 8-bit PIC Model microcontroller made by Microchip
This micrcontroller is lower performance and is typically used for embedded applications which
don't need compex processing or complex software.

4. TI MSP432 LaunchPad: 32-bit micrcontroller


5. Raspberry Pi 3 Model B embedded computer, it's not a microcontroller

LESSON 3: THE MSP432 MICRCONTROLLER

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.

2. Shields and BoosterPacks


Here's a couple of examples of booster packs, and these are a type of shield that fit on top of
MSP432 and are available from TI.

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.

3. Programming and Executing Code


How do microcontrollers actually execute code?

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.

The final purpose of this onboard emulator is to provide power to the


microcontroller from your laptop. So this emulator serves a lot of different purposes
and make it easy to test out programs and execute programs during prototyping.

Microcontroller operates in 2 different mode:


1. Programming Mode
The diagram here shows that the micrcontroller has both a flash memory bank and
an arithmetic and logic unit (ALU) which is part of the CPU.

In Programming mode, there's an external programmer which can also be that


onboard emulator for development kit, that external programmer writes data or
program directly to the flash memory.
The CPU or the ALU isn't really do anything, it's essentially idle waiting for that
program to be loaded.

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.

Documentation for the MSP432 LaunchPad

You might also like