Microcontrollers
Embedded
systems
Basics
Seinäjoki University of Applied Sciences
What you need ?
Basics of digital technology: what means bit, byte,
locigal operations…
Basics of electronics: voltage, current
Basics of C or JAVA programming helps also but not
absolutely needed
Interest and desire in developing a intelligent
electronics
What is the core of
embedded systems ?
You can develope programs (behaviour) using PC for
intelligent electronics, which is based on
microcontroller
Using programs, you can measure and control inputs
and outputs, which can be connected to other devices.
You program using C or C++ language. You need also the
digital based commands and bit manipulations.
You need tools to do that: programing environment and
of course microcontroller based electronics.
Microprocessor
Microprocessor
executes bit
manipulations,
calculations and
data transfer. It
processes data
Microprocessor
needs peripheral
circuits to function:
program memory,
data memory,
peripheral interfaces
etc.
Microcontroller
Controller is a small
scale computer inluding
microprocessor and also
the functions of
peripheral interfaces:
memories, A/D
conversions for
measuring,
input/output signals,
data busses: (SPI,USART,
TWI,CAN…), counters,
clock kalender etc.
Programming
Programming is a way to tell to the
microcontroller, what is the executed job.
You write the program using C language.
The compiler converts it to binary code,
which you transfer to program memory of
controller.
CPU (central processing unit) executes the
binary code (=instructions).
CPU uses data memory to save data
temporary.
CPU uses also registers, which controls all
peripheral functions: measurings, I/O
signals, busses etc.
The plan of programming
You know, what you are
doing, if you make first
for example block
diagram.
You must add
comments on your own
language. In other case
you do not understand
your program
tomorrow itself. (C++
language is not your
mother language)
Compiler versus interpreter
Compiler converts source code text (for example C++
language) to binary code whch the controller
understand as instructions.
Assembler compiler converts symbolic instructions to
binary instructions.
There must be different compilers for every different
controller.
Interpreter executes standard format command table
(code) line by line. Every different controller needs its
own interpreter, but code is same in all cases(for
example JAVA).
C / C++ programming language
In this teaching material you use C+
+ language, but using mostly only
standard C language formats.
Some C++ features are not in use.
The most used compilers in
embedded systems is open-source
gcc compilers.
For Atmel AVR controllers you use
gcc compiler version WinAVR,
which is including in AtmelStudio
software.
What tools you need ?
PC with windows or linux
Text editor to edit C++ language source code
C++ compiler, which converts your text to binary code.
Loading program, which moves the binary code to program
memory in controller.
Electronic printed circuit board (PCB) including
microcontroller
Also the simulation feature is helpfull. So you can test the
program step by step before you move it to microcontroller
Free tools
AtmelStudio includes text editor and user interface for
external tools
https://www.microchip.com/mplab/avr-support/atmel-
studio-7
WinAVR C/C++ compiler is implemented already into
AtmelStudio
FLIP program, which transfers the compiled binary code
to program flash memory in controller
https://www.microchip.com/DevelopmentTools/Produc
tDetails/PartNO/FLIP
Electronic kit including ATmega32U4 microcontroller
and connectors