Microcontroller Lab.
Eng.Khaled Tamizi

Mechanical Department
Mechatronic

PPU

IUT Cachan

Project Pedagogy approach of M...
1 Microcontroller overview
Microcontroller in an industrial system

PTC Khadoury

IUT Cachan

Project Pedagogy approach of...
1 Microcontroller overview
1.1 Industrial automation systems overview
1.2 Microcontroller architecture
1.3 The pedagogical...
1.1 Industrial automation systems overview

Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup

4
1.1 Industrial automation systems overview
Energy

other
microcontrollers
other systems

HumanMachine
Interface

Energy

C...
1.1 Industrial automation systems overview
Energy
Actuators

Energy

other
microcontrollers
other systems

Commands

Elect...
1.1 Industrial automation systems overview
Energy

other
microcontrollers
other systems

HumanMachine
Interface

Energy

C...
1.1 Industrial automation systems overview
Energy

Energy

Pre-Actuators
other
microcontrollers
other systems

HumanMachin...
1.1 Industrial automation systems overview
Energy

other
microcontrollers
other systems

HumanMachine
Interface

Energy

C...
1.1 Industrial automation systems overview
Energy

inductive detector
HumanMachine
Interface

User

Energy

Commands

othe...
1.1 Industrial automation systems overview
Energy

other
microcontrollers
other systems

HumanMachine
Interface

Energy

C...
1.1 Industrial automation systems overview
Energy

Human-Machine Interface
other
microcontrollers
other systems

Commands
...
1.1 Industrial automation systems overview
Which device for command part ?
Few systems : for example Factory Automation
Lo...
1.1 Industrial automation systems overview
Microcontroller applications

Embedded control : inverter, PLC (!), hover, wash...
1.2 Microcontroller architecture

Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup

15
1.2 Microcontroller architecture

Data
memory
(RAM)

control signals

Program
memory
(Flash)

Central
Processing
Unit
(CPU...
1.2 Microcontroller architecture

Program
memory
(Flash)

Timers

Central
Processing
Unit
(CPU)

Internal
peripherals
Inte...
1.2 Microcontroller architecture
communication
peripherals
Data
memory
(RAM)

control signals

Program
memory
(Flash)

Cen...
1.2 Microcontroller architecture
communication
peripherals
Data
memory
(RAM)

control signals

Program
memory
(Flash)

Cen...
1.2 Microcontroller architecture
communication
peripherals
Data
memory
(RAM)

control signals

Program
memory
(Flash)

Cen...
1.2 Microcontroller architecture
communication
peripherals
Data
memory
(RAM)

control signals

Program
memory
(Flash)

Cen...
1.2 Microcontroller architecture
communication
peripherals
Data
memory
(RAM)

control signals

Program
memory
(Flash)

Cen...
1.2 Microcontroller architecture
communication
peripherals
Data
memory
(RAM)

control signals

Program
memory
(Flash)

Cen...
1.2 Microcontroller architecture
communication
peripherals
Data
memory
(RAM)

control signals

Program
memory
(Flash)

Cen...
1.2 Microcontroller architecture
communication
peripherals
Data
memory
(RAM)

control signals

Program
memory
(Flash)

Cen...
1.2 Microcontroller architecture
semiconductors manufacturers

2004 : 12 Milliards $

8 bits microcontrollers
- Microchip
...
1.3 The pedagogical robot

Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup

27
1.3 The pedagogical robot

Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup

28
1.3 The pedagogical robot

Synoptic

Lead
battery

Analog and digital
sensors data

Optical
sensors

Ultrasonic
sensor

Mi...
1.3 The pedagogical robot
Energy

UART
I 2C
ultrasonic
telemeter
jack &
buttons
Potentiometer
LCD
Display

communication
p...
1.3 The pedagogical robot

THE
RACE

Basic State Machine

Communication Peripherals
Interrupts

The robot Obstacle Shortcu...
1.4 Digital inputs / outputs

Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup

32
1.4 Digital inputs / outputs
Example of device plugged on a digital input : a pushbutton
communication
peripherals

Data
m...
1.4 Digital inputs / outputs
Example of device plugged on a digital input : a pushbutton
Other
peripherals

VCC = 5V

Tri-...
1.4 Digital inputs / outputs
Example of device plugged on a digital output : a led
communication
peripherals

Data
memory
...
1.4 Digital inputs / outputs
Example of device plugged on a digital output : a led
Other
peripherals

latch
RA6

writing o...
1.4 Digital inputs / outputs
Example of device plugged on digital in/outputs : LCD display
communication
peripherals

Data...
1.4 Digital inputs / outputs
Example of device plugged on digital in/outputs : LCD display
Other
peripherals
Central
Proce...
1.4 Digital inputs / outputs
Generic Input / output pin schematic
Tri-state buffer
to select input
or output mode
output l...
1.4 Digital inputs / outputs
How to program input reading
(for example the state of a pushbutton bp0 plugged on RB3)
1st s...
1.4 Digital inputs / outputs
How to program output writing
(for example switching on a led plugged on RA6)

1st step, conf...
1.4 Digital inputs / outputs
How to program output writing
(for example switching off a led plugged on RA6)

1st step, con...
1.5 Embedded program flow chart

Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup

43
1.5 Flow chart

variables definition and initialization

Peripherals configuration

Inputs reading

Treatment

Outputs wri...
1.5 Flow chart
main(){
Variables definition and initializations
peripherirals configuration
while (1) {
Inputs reading
tre...
Upcoming SlideShare
Loading in …5
×

Lecture1 microcontrolleroverview-afdhalmesin2008usk

348 views

Published on

mesin08

Published in: Education
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
348
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Lecture1 microcontrolleroverview-afdhalmesin2008usk

  1. 1. Microcontroller Lab. Eng.Khaled Tamizi Mechanical Department Mechatronic PPU IUT Cachan Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 1
  2. 2. 1 Microcontroller overview Microcontroller in an industrial system PTC Khadoury IUT Cachan Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 2
  3. 3. 1 Microcontroller overview 1.1 Industrial automation systems overview 1.2 Microcontroller architecture 1.3 The pedagogical robot 1.4 Digital Inputs/Outputs 1.5 Embedded C Language Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 3
  4. 4. 1.1 Industrial automation systems overview Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 4
  5. 5. 1.1 Industrial automation systems overview Energy other microcontrollers other systems HumanMachine Interface Energy Commands Preactuators Actuators Command Part Informations Interface Sensors User Operative part Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 5
  6. 6. 1.1 Industrial automation systems overview Energy Actuators Energy other microcontrollers other systems Commands Electric Actuators : Motors PreActuators Actuators HumanMachine Interface Command Command Pneumatic Part Part or hydraulic Informations Interface actuators : cylinders Sensors User Operative part Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 6
  7. 7. 1.1 Industrial automation systems overview Energy other microcontrollers other systems HumanMachine Interface Energy Commands PreActuators Actuators Command Part Informations Interface Sensors User Operative part Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 7
  8. 8. 1.1 Industrial automation systems overview Energy Energy Pre-Actuators other microcontrollers other systems HumanMachine Interface Motor drives / Commands inverters PreActuators Actuators Command Part electropneumatic Interface Sensors or electrohydraulic valves Informations User Operative part Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 8
  9. 9. 1.1 Industrial automation systems overview Energy other microcontrollers other systems HumanMachine Interface Energy Commands PreActuators Actuators Command Part Informations Interface Sensors User Operative part Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 9
  10. 10. 1.1 Industrial automation systems overview Energy inductive detector HumanMachine Interface User Energy Commands other microcontrollers other systems Sensors PreActuators Actuators contact detector optical detector Command Part Informations Optical encoder (for motor axes) Interface Sensors Camera Operative part Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 10
  11. 11. 1.1 Industrial automation systems overview Energy other microcontrollers other systems HumanMachine Interface Energy Commands PreActuators Actuators Command Part Informations Interface Sensors User Operative part Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 11
  12. 12. 1.1 Industrial automation systems overview Energy Human-Machine Interface other microcontrollers other systems Commands Energy PreActuators Actuators Lights and buttons HumanMachine Interface Command Part Informations Interface Touch screens Sensors User Operative part Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 12
  13. 13. 1.1 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 Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 13
  14. 14. 1.1 Industrial automation systems overview Microcontroller applications Embedded control : inverter, PLC (!), hover, wash machine Automotive : safety, comfort, motor control… Multimedia devices : phones, PDA, … Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 14
  15. 15. 1.2 Microcontroller architecture Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 15
  16. 16. 1.2 Microcontroller architecture Data memory (RAM) control signals Program memory (Flash) Central Processing Unit (CPU) control signals control signals Commands Data bus other command parts communication peripherals Output peripherals control signals User information internal peripherals control signals information inputs peripherals control signals User Commands Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 16
  17. 17. 1.2 Microcontroller architecture Program memory (Flash) Timers Central Processing Unit (CPU) Internal peripherals Internal clock Data memory (RAM) Data bus other command parts communication peripherals Commands Digital Outputs Output peripherals PWM Outputs User (Pulse Width Information Modulation) Digital Information Inputs Input peripherals Fast User counting Analog to Commands Inputs digital converter Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 17
  18. 18. 1.2 Microcontroller architecture communication peripherals Data memory (RAM) control signals Program memory (Flash) Central Processing Unit (CPU) control signals control signals Commands Data bus other command parts CPU Output peripherals control signals User information internal peripherals control signals information inputs peripherals control signals User Commands Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 18
  19. 19. 1.2 Microcontroller architecture communication peripherals Data memory (RAM) control signals Program memory (Flash) Central Processing Unit (CPU) control signals control signals Commands Data bus other command parts CPU Output peripherals control signals User information internal peripherals control signals information inputs peripherals control signals User Commands Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 19
  20. 20. 1.2 Microcontroller architecture communication peripherals Data memory (RAM) control signals Program memory (Flash) Central Processing Unit (CPU) control signals control signals Commands Data bus other command parts Program Memory Output peripherals control signals User information internal peripherals control signals information inputs peripherals control signals User Commands Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 20
  21. 21. 1.2 Microcontroller architecture communication peripherals Data memory (RAM) control signals Program memory (Flash) Central Processing Unit (CPU) control signals control signals Commands Data bus other command parts Program Memory Output peripherals control signals User information internal peripherals control signals information inputs peripherals control signals User Commands Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 21
  22. 22. 1.2 Microcontroller architecture communication peripherals Data memory (RAM) control signals Program memory (Flash) Central Processing Unit (CPU) control signals control signals Commands Data bus other command parts Data Memory Output peripherals control signals User information internal peripherals control signals information inputs peripherals control signals User Commands Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 22
  23. 23. 1.2 Microcontroller architecture communication peripherals Data memory (RAM) control signals Program memory (Flash) Central Processing Unit (CPU) control signals control signals Commands Data bus other command parts Data Memory Output peripherals control signals User information internal peripherals control signals information inputs peripherals control signals User Commands Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 23
  24. 24. 1.2 Microcontroller architecture communication peripherals Data memory (RAM) control signals Program memory (Flash) Central Processing Unit (CPU) control signals control signals Commands Data bus other command parts Data bus Output peripherals control signals User information internal peripherals control signals information inputs peripherals control signals User Commands Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 24
  25. 25. 1.2 Microcontroller architecture communication peripherals Data memory (RAM) control signals Program memory (Flash) Central Processing Unit (CPU) control signals control signals Commands Data bus other command parts Data bus Output peripherals control signals User information internal peripherals control signals information inputs peripherals control signals User Commands Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 25
  26. 26. 1.2 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 5% 31% 37% 4 bits 8 bits 27% 16 bits 32 bits - Renesas (ex. Mitsubishi / Hitachi) source IC Insights - Microchip (µC and Digital Signal Controller) - Infineon (ex. Siemens) - Atmel, Freescale, Intel, Texas Instruments, Toshiba… 32 bits microcontrollers - Atmel (Arm core) - Infineon (TriCore : Risc, Cisc & DSP) - Freescale (Arm, PowerPC or Coldfire 68000 core) - Renesas, Nec, Texas Instruments, Toshiba… Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 26
  27. 27. 1.3 The pedagogical robot Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 27
  28. 28. 1.3 The pedagogical robot Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 28
  29. 29. 1.3 The pedagogical robot Synoptic Lead battery Analog and digital sensors data Optical sensors Ultrasonic sensor Microcontroller board Pulse width modulation control data Power electronic board Optical encoders Buttons LCD Angular positions Line Obstacle Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 29
  30. 30. 1.3 The pedagogical robot Energy UART I 2C ultrasonic telemeter jack & buttons Potentiometer LCD Display communication peripherals Digital Input PWM Outputs Microcontroller Analog to digital converter Analog to digital converter Digital outputs Fast counting Inputs Commands line info position info Chopper + Motors Infrared sensors Motors encoders Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 30
  31. 31. 1.3 The pedagogical robot THE RACE Basic State Machine Communication Peripherals Interrupts The robot Obstacle Shortcut follows detection detection the line Analog to Digital Converter Timers / Counters Pulse Width Modulation Development tools Digital Inputs/Outputs The robot Speed & starts and position stops control Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 31
  32. 32. 1.4 Digital inputs / outputs Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 32
  33. 33. 1.4 Digital inputs / outputs Example of device plugged on a digital input : a pushbutton communication peripherals Data memory (RAM) control signals control signals internal peripherals control signals VCC = 5V Output peripherals 4,7 kOhms Central Processing Unit (CPU) Data bus Program memory (Flash) control signals inputs control signals peripherals control signals i=1 A i=0 mA VR=0 V =5 RB3 5V 0 control signals BPx pushbutton pressed : logic level 0 pushbutton not pressed : logic level 1 GND Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 33
  34. 34. 1.4 Digital inputs / outputs Example of device plugged on a digital input : a pushbutton Other peripherals VCC = 5V Tri-state buffer RB3 4,7 kOhms 8-bit data bus Central Processing Unit (CPU) Enable BPx reading PORTB GND Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 34
  35. 35. 1.4 Digital inputs / outputs Example of device plugged on a digital output : a led communication peripherals Data memory (RAM) control signals internal peripherals 1 Output 0 peripherals control signals inputs control signals peripherals control signals control signals Logic level 0 : the led is OFF Logic level 1 : the led is ON RA6 680 Ohms control signals control signals VA6=5V =0V Central Processing Unit (CPU) Data bus Program memory (Flash) i = 0 mA 6 GND Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 35
  36. 36. 1.4 Digital inputs / outputs Example of device plugged on a digital output : a led Other peripherals latch RA6 writing on PORTA 680 Ohms 8-bit data bus Central Processing Unit (CPU) GND Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 36
  37. 37. 1.4 Digital inputs / outputs Example of device plugged on digital in/outputs : LCD display communication peripherals Data memory (RAM) control signals Central Processing Unit (CPU) control signals internal peripherals control signals Data bus Program memory (Flash) Input / Output peripherals Parallel Port 4 RD0-RD3 control signals control signals Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 37
  38. 38. 1.4 Digital inputs / outputs Example of device plugged on digital in/outputs : LCD display Other peripherals Central Processing Unit (CPU) latch Tri-state buffer 8-bit data bus En writing on PORTD selecting input or output mode RD0 Tri-state buffer En reading PORTD Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 38
  39. 39. 1.4 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 Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 39
  40. 40. 1.4 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 TRISB x x x x 1 x x x RB3 is configured as an input 3rd char bp0; TRISB = TRISB | 0b00001000; bp0 = PORTBbits.RB3; step, read the value of RB3 or and store it in bp0 bp0 = PORTB & 0b00001000; Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 40
  41. 41. 1.4 Digital inputs / outputs How to program output writing (for example switching on a led plugged on RA6) 1st step, configure RA6 as an output TRISA x 0 x x x x x x RA6 is configured as an output 2nd step, write a value of RA6 TRISA = TRISA & 0b10111111; PORTAbits.RA6 = 1; or PORTA = PORTA | 0b01000000; Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 41
  42. 42. 1.4 Digital inputs / outputs How to program output writing (for example switching off a led plugged on RA6) 1st step, configure RA6 as an output TRISA x 0 x x x x x x RA6 is configured as an output 2nd step, write a value of RA6 TRISA = TRISA & 0b10111111; PORTAbits.RA6 = 0; or PORTA = PORTA & 0b10111111; Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 42
  43. 43. 1.5 Embedded program flow chart Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 43
  44. 44. 1.5 Flow chart variables definition and initialization Peripherals configuration Inputs reading Treatment Outputs writing Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 44
  45. 45. 1.5 Flow chart main(){ Variables definition and initializations peripherirals configuration while (1) { Inputs reading treatments Outputs writing } } Project Pedagogy approach of Microcontroller – Palestinian Robotic Cup 45

×