Title: Compte rendu Technique de Projet
1Workshop Craiova Cachan Robotic Cup
Project pedagogy approach of microcontrollers
Craiova University
IUT Cachan
2Microcontroller overview
Microcontroller in an industrial system
IUT Cachan
Craiova University
31 Microcontroller overview
1 Industrial automation systems overview2
Microcontroller architecture 3 Digital
Inputs/Outputs 4 Embedded C Language
41 Industrial automation systems overview
51 Industrial automation systems overview
Energy
Energy
other microcontrollers other systems
Pre- actuators
Actuators
Commands
Command Part
Human- Machine Interface
Sensors
Interface
Informations
User
Operative part
61 Industrial automation systems overview
Energy
Energy
other microcontrollers other systems
Pre- Actuators
Actuators
Commands
Command Part
Command Part
Human- Machine Interface
Sensors
Interface
Informations
User
Operative part
71 Industrial automation systems overview
Energy
Energy
other microcontrollers other systems
Pre- Actuators
Actuators
Commands
Command Part
Human- Machine Interface
Sensors
Interface
Informations
User
Operative part
81.1 Industrial automation systems overview
Energy
Energy
other microcontrollers other systems
Pre- Actuators
Actuators
Commands
Command Part
Human- Machine Interface
Sensors
Interface
Informations
User
Operative part
91 Industrial automation systems overview
Energy
Energy
other microcontrollers other systems
Pre- Actuators
Actuators
Commands
Command Part
Human- Machine Interface
Sensors
Interface
Informations
User
Operative part
101 Industrial automation systems overview
Energy
Energy
other microcontrollers other systems
Pre- Actuators
Actuators
Commands
Command Part
Human- Machine Interface
Sensors
Interface
Informations
User
Operative part
111 Industrial automation systems overview
Energy
Energy
other microcontrollers other systems
Pre- Actuators
Actuators
Commands
Command Part
Human- Machine Interface
Sensors
Interface
Informations
User
Operative part
121 Industrial automation systems overview
Energy
Energy
other microcontrollers other systems
Pre- Actuators
Actuators
Commands
Command Part
Human- Machine Interface
Sensors
Interface
Informations
User
Operative part
131 Industrial automation systems overview
Which device for command part ?
Few systems for example Factory Automation Low
development cost Quick and safe development
PLC (programmable logic controller)
Many systems for example Automotive Brake
system Cheap and small device
Microcontroller
141 Industrial automation systems overview
Microcontroller applications
Embedded control inverter, PLC (!), hover, wash
machine
Automotive safety, comfort, motor control
Multimedia devices phones, PDA,
152 Microcontroller architecture
162 Microcontroller architecture
communication peripherals
other command parts
Data memory (RAM)
control signals
Central Processing Unit (CPU)
Program memory (Flash)
control signals
Commands
Output peripherals
control signals
Data bus
User information
control signals
internal peripherals
information
control signals
inputs peripherals
User Commands
control signals
172 Microcontroller architecture
communication peripherals
other command parts
Data memory (RAM)
Central Processing Unit (CPU)
Program memory (Flash)
Digital Outputs
Commands
Output peripherals
Data bus
PWM Outputs (Pulse Width Modulation)
User Information
Timers
Internal peripherals
Digital Inputs
Internal clock
Information
Input peripherals
Fast counting Inputs
User Commands
Analog to digital converter
182 Microcontroller architecture
CPU
communication peripherals
other command parts
Data memory (RAM)
control signals
Central Processing Unit (CPU)
Program memory (Flash)
control signals
Commands
Output peripherals
control signals
Data bus
User information
control signals
internal peripherals
information
control signals
inputs peripherals
User Commands
control signals
192 Microcontroller architecture
CPU
communication peripherals
other command parts
Data memory (RAM)
control signals
Central Processing Unit (CPU)
Program memory (Flash)
control signals
Commands
Output peripherals
control signals
Data bus
User information
control signals
internal peripherals
information
control signals
inputs peripherals
User Commands
control signals
202 Microcontroller architecture
Program Memory
communication peripherals
other command parts
Data memory (RAM)
control signals
Central Processing Unit (CPU)
Program memory (Flash)
control signals
Commands
Output peripherals
control signals
Data bus
User information
control signals
internal peripherals
information
control signals
inputs peripherals
User Commands
control signals
212 Microcontroller architecture
Program Memory
communication peripherals
other command parts
Data memory (RAM)
control signals
Central Processing Unit (CPU)
Program memory (Flash)
control signals
Commands
Output peripherals
control signals
Data bus
User information
control signals
internal peripherals
information
control signals
inputs peripherals
User Commands
control signals
222 Microcontroller architecture
Data Memory
communication peripherals
other command parts
Data memory (RAM)
control signals
Central Processing Unit (CPU)
Program memory (Flash)
control signals
Commands
Output peripherals
control signals
Data bus
User information
control signals
internal peripherals
information
control signals
inputs peripherals
User Commands
control signals
232 Microcontroller architecture
Data Memory
communication peripherals
other command parts
Data memory (RAM)
control signals
Central Processing Unit (CPU)
Program memory (Flash)
control signals
Commands
Output peripherals
control signals
Data bus
User information
control signals
internal peripherals
information
control signals
inputs peripherals
User Commands
control signals
242 Microcontroller architecture
Data bus
communication peripherals
other command parts
Data memory (RAM)
control signals
Central Processing Unit (CPU)
Program memory (Flash)
control signals
Commands
Output peripherals
control signals
Data bus
User information
control signals
internal peripherals
information
control signals
inputs peripherals
User Commands
control signals
252 Microcontroller architecture
Data bus
communication peripherals
other command parts
Data memory (RAM)
control signals
Central Processing Unit (CPU)
Program memory (Flash)
control signals
Commands
Output peripherals
control signals
Data bus
User information
control signals
internal peripherals
information
control signals
inputs peripherals
User Commands
control signals
262 Microcontroller architecture
semiconductors manufacturers
2004 12 Milliards
8 bits microcontrollers - Microchip - Freescale
(ex. Motorola) - Cypress (µC and PSoC) - Nec,
Toshiba, ST, Philips,
16 bits microcontrollers - Renesas (ex.
Mitsubishi / Hitachi) - Microchip (µC and
Digital Signal Controller) - Infineon (ex.
Siemens) - Atmel, Freescale, Intel, Texas
Instruments, Toshiba
source IC Insights
32 bits microcontrollers - Atmel (Arm core) -
Infineon (TriCore Risc, Cisc DSP) -
Freescale (Arm, PowerPC or Coldfire 68000
core) - Renesas, Nec, Texas Instruments, Toshiba
273 Digital inputs / outputs
283 Digital inputs / outputs
Example of device plugged on a digital input a
pushbutton
communication peripherals
Data memory (RAM)
control signals
Program memory (Flash)
Central Processing Unit (CPU)
control signals
control signals
Output peripherals
VCC 5V
control signals
Data bus
control signals
4,7 kOhms
internal peripherals
inputs peripherals
control signals
RB3
control signals
control signals
BPx
pushbutton pressed logic level 1 pushbutton not
pressed logic level 0
GND
293 Digital inputs / outputs
Example of device plugged on a digital input a
pushbutton
Other peripherals
Central Processing Unit (CPU)
VCC 5V
4,7 kOhms
Tri-state buffer
RB3
8-bit data bus
Enable
BPx
reading PORTB
GND
303 Digital inputs / outputs
Example of device plugged on a digital output a
led
communication peripherals
Data memory (RAM)
control signals
Program memory (Flash)
Central Processing Unit (CPU)
control signals
control signals
Output peripherals
RA6
control signals
Data bus
control signals
internal peripherals
680 Ohms
inputs peripherals
control signals
control signals
control signals
Logic level 0 the led is OFF Logic level 1
the led is ON
GND
313 Digital inputs / outputs
Example of device plugged on a digital output a
led
Other peripherals
Central Processing Unit (CPU)
latch
RA6
680 Ohms
writing on PORTA
8-bit data bus
GND
323 Digital inputs / outputs
Example of device plugged on digital in/outputs
LCD display
communication peripherals
Data memory (RAM)
control signals
Program memory (Flash)
Central Processing Unit (CPU)
control signals
Input / Output peripherals
control signals
Data bus
Parallel Port
internal peripherals
4
RD0-RD3
control signals
control signals
333 Digital inputs / outputs
Example of device plugged on digital in/outputs
LCD display
Other peripherals
Central Processing Unit (CPU)
latch
Tri-state buffer
En
RD0
selecting input or output mode
writing on PORTD
Tri-state buffer
8-bit data bus
En
reading PORTD
343 Digital inputs / outputs
Generic Input / output pin schematic
Tri-state buffer to select input or output mode
output latch
selecting mode circuit
Tri-state buffer for input reading
353 Digital inputs / outputs
How to program input reading (for example the
state of a pushbutton bp0 plugged on RB3)
1st step, define a variable to store the
state of the pushbutton
2nd step, configure RB3 as an input
x
TRISB
x
x
x
1
x
x
x
char bp0
RB3 is configured as an input
TRISB TRISB 0b00001000
bp0 PORTBbits.RB3 or bp0 PORTB 0b00001000
3rd step, read the value of RB3 and
store it in bp0
363 Digital inputs / outputs
How to program output writing (for example
switching on a led plugged on RA6)
1st step, configure RA6 as an output
x
TRISA
0
x
x
x
x
x
x
RA6 is configured as an output
TRISA TRISA 0b10111111
PORTAbits.RA6 1 or PORTA PORTA 0b01000000
2nd step, write a value of RA6
373 Digital inputs / outputs
How to program output writing (for example
switching off a led plugged on RA6)
1st step, configure RA6 as an output
x
TRISA
0
x
x
x
x
x
x
RA6 is configured as an output
TRISA TRISA 0b10111111
PORTAbits.RA6 0 or PORTA PORTA 0b10111111
2nd step, write a value of RA6
384 Embedded program flow chart
394 Flow chart
variables definition and initialization
Peripherals configuration
Inputs reading
Treatment
Outputs writing
404 Flow chart
Variables definition and initializations
peripherirals configuration
while (1) Inputs reading treatments Output
s writing