6.Computing Mecatrónica

Embed Size (px)

Citation preview

  • 8/9/2019 6.Computing Mecatrónica

    1/15

    1

    1540 Introduction To Mechatronics: Slide 1Stefan Williams

    Introduction to MechatronicsMech-1540

    Computers

    1540 Introduction To Mechatronics: Slide 2Stefan Williams

    Schedule of Events

    MID SEMESTER BREAK 

    Spare19/614

    Due 13/6Major Assignment12/613

    Case Study : Unmanned Air/Land/Sea Vehicles5/612

    Case Study : Formula SAE29/511

    Active Sensor Systems (Graham Brooker)22/510

    Due 16/5Assignment 2 - Control and Modelling15/59

    Q 3 of Assign 2System Modellingand Control8/58

    Q 2 of Assign 2Computer – Software and Design Tools1/57

    6

    5

    4

    3

    2

    1

    Week 

    17/4

    10/4

    3/4

    27/3

    20/3

    13/3

    Date

    Computer – Hardware

    Assignment 1 –Design Exercise

    Sensors

    Actuators

    Design Process

    Introduction

    Content

    Q 1 of Assign 2

    Due 11/4

    Q 3 of Assign 1

    Q 2 of Assign 1

    Q 1 of Assign. 1

    Assignment Notes

    1540 Introduction To Mechatronics: Slide 3Stefan Williams

    Computing: Summary

    1. Embedded Computing Systems

    2. Embedded Systems Processors3. Input and Output

    4. Communications

    5. Real-time algorithms

    1540 Introduction To Mechatronics: Slide 4Stefan Williams

    Mechatronics and Computers

    Embedded computing Characteristics:

    • Real-time systems• Safety and Integrity

    • Real-World Interfaces

    • Sensors/Actuators

    • Algorithms for “intelligence” and control

  • 8/9/2019 6.Computing Mecatrónica

    2/15

    2

    1540 Introduction To Mechatronics: Slide 5Stefan Williams

    Typical System Structure

    Control

    Computer [µ p]

    D/A

    A/D

    Digital

    Sensor 

    Analog

    Sensor Actuator 

    Off/On

    Sensor 

    Off/On

    Actuator 

    Analog

    Digital

    Parallel

    1540 Introduction To Mechatronics: Slide 6Stefan Williams

    Typical Processors

    • Programmable Logic Controller (PLC)• Micro-controllers (µp)

    • General purpose processors (PC)

    • Digital Signal Processors (DSP)

    • Field Programmable Gate Array (FPGA)

    1540 Introduction To Mechatronics: Slide 7Stefan Williams

    Programmable Logic

    Controllers

    • Workhorse of the automation industry

    • Uses Relay Logic:

    If A and B then output XIf X and not Y then signal 23

    • Inputs/Outputs are physical relays

    • High degree of isolation and ruggedness

    1540 Introduction To Mechatronics: Slide 8Stefan Williams

    PLC Structure

    • A PLC consists of:

     – A CPU

     – Memory areas,

     – Appropriate circuits to receive input/output data.

  • 8/9/2019 6.Computing Mecatrónica

    3/15

    3

    1540 Introduction To Mechatronics: Slide 9Stefan Williams

    PLC Components

    • INPUT RELAYS physically exist and receive signals fromswitches, sensors

    • INTERNAL UTILITY RELAYS simulated relays dedicatedto performing only one task

    • COUNTERS simulated pulse counters possibly hardwarehigh-speed counters

    • TIMERS come in many varieties and increments.

    • OUTPUT RELAYS physically exist, are connected to theoutside

    • DATA STORAGE-registers assigned to store data.Usually temporary, also used to store data when power isremoved

    1540 Introduction To Mechatronics: Slide 10Stefan Williams

    PLCs

    • A PLC can be considered as a box full of

    hundreds or thousands of separate relays,counters, timers and data storage locations.

    • Counters, timers, etc. do not all physicallyexist instead they are simulated in softwarethrough bit locations in registers.

    •http://www.plcs.net/contents.shtml

    •http://www.wodonga.tafe.edu.au/eemo/EA160/over.htm

    1540 Introduction To Mechatronics: Slide 11Stefan Williams

    PLC Example

    • Manufacturers: Omron, Allan Bradley, GEC

    Input Unit

    Output Unit

    CPU(s)

    Power Supply(s)

    Remote Coms.

    1540 Introduction To Mechatronics: Slide 12Stefan Williams

    PLC Components

    Block and Remote

    I/O units

    PLC Network 

  • 8/9/2019 6.Computing Mecatrónica

    4/15

    4

    1540 Introduction To Mechatronics: Slide 13Stefan Williams

    When to use a PLC

    Applications that:

    • Are repetitive sequences of events

    • Require high reliability in execution

    • Placed in a rugged environment

    • Do not require flexiblity

    • Do not require complex algorithms

    • Focus on event sequences

    1540 Introduction To Mechatronics: Slide 14Stefan Williams

    µ processors

    • Used extensively inconsumer products

    • Low cost, highflexibility,

    • As much integrated onchip as possible

    • Low-level programmingis typical

    http://www.microchip.com/ PIC Processor  

    1540 Introduction To Mechatronics: Slide 15Stefan Williams

    Example Intel-ARM

    Processor 

    Low-power 

    Real Time Clock  On-Chip Memory

    External BIT

    Serial/USB Comms 1540 Introduction To Mechatronics: Slide 16Stefan Williams

    ARM Processing Core

     – Intel SA-1 core

     – 16-Kbyte instructionand 8-Kbyte datacache,

     – memory-management units,

     – read and writebuffers

  • 8/9/2019 6.Computing Mecatrónica

    5/15

    5

    1540 Introduction To Mechatronics: Slide 17Stefan Williams

    ARM System ControlModule

    28 GP I/O ports,

    real-time clock,

    watchdog,

    interval timers,

    power management

    interrupt controller,

    reset controller,

    two on-chip oscillators.1540 Introduction To Mechatronics: Slide 18Stefan Williams

    ARM Peripheral ControlModule

    DMA controller,LCD controller,UART Serial ,IrDA serial port,USB end point,codec interface

    1540 Introduction To Mechatronics: Slide 19Stefan Williams

    When to Use aµP

    • Wide Application inconsumer products

    • Particularly mobile

    phones and high-endapps.

    • Low cost, reliable

    • Programming istypically in C

    1540 Introduction To Mechatronics: Slide 20Stefan Williams

    General Purpose Processors

    • Single high-speed processor 

    • General arithmetic (floating point)

    • Cache data pipeline etc.

    • Example include

    • 80486, Pentium and derivatives

    • M68030, Power PC, and derivatives

    • RISC processors

  • 8/9/2019 6.Computing Mecatrónica

    6/15

    6

    1540 Introduction To Mechatronics: Slide 21Stefan Williams

    Example: PC104

    • 486/586 processor 

    • Standard form factor • Standard pin connectors

    • Large I/O is typical

    • On-board battery-backed ram etc.

    • Many peripheral boards

    • http://www.pc104.com

    1540 Introduction To Mechatronics: Slide 22Stefan Williams

    PC-104 Advantages

    • Conventional PC hardware:• Code that runs on the desk-top will run on

    embedded system (RT-OS may be necessary)

    • Uses commodity chip sets and is thus cheap

    and benefits from the latest technology

    • Can be made in robust packaged form.

    1540 Introduction To Mechatronics: Slide 23Stefan Williams

    CPU Elements

    • ALU

     – often microprogrammed

    → CISC – hardwired, with

    instruction cache

    → RISC

    • program counter (PC)

     – stores address of next

    instruction

    • registers

     – instruction register 

     – general registers – address and data

    registers (buffers)

    • control unit

     – controls on-chip and

    external memory

    1540 Introduction To Mechatronics: Slide 24Stefan Williams

    CPU Block Diagram

  • 8/9/2019 6.Computing Mecatrónica

    7/157

    1540 Introduction To Mechatronics: Slide 25Stefan Williams

    Peripheral IC Examples

    (on-board)

    • UART - Universal AsynchronousReceiver/Transmitter (UART, USART, etc)

    • SIO - (Synchronous) Serial I/O

    • PIO - Parallel I/O (PPI, etc)

    • CTC - Counter/Timer (PIT, etc)

    • A/D - Analogue to Digital Converter 

    • D/A - Digital to Analogue Converter 

    1540 Introduction To Mechatronics: Slide 26Stefan Williams

    PC104 Stacks

    • CPU Board

    • Power Supply

    • I/O drivers

    • Control relays

    • DSP Slave

    • Etc

    • Many add-ons

    are available

    1540 Introduction To Mechatronics: Slide 27Stefan Williams

    When to use a PC104

    • Large, complex calculations or system

    sophistication

    • Large, sensor and/or interface requirements

    • Possibly requiring a conventional-type userinterface

    • Robustness is not main aim of system (canbe made reliable)

    • Quick to develop new applications

    1540 Introduction To Mechatronics: Slide 28Stefan Williams

    Digital Signal Processor (DSP)

    • Very high speedrepetitive computation

    • Speech, image or radar

    processing• Uses vector processingand instruction pipe-line

    • Usually used as co-processors

    • Often used in arrays

  • 8/9/2019 6.Computing Mecatrónica

    8/158

    1540 Introduction To Mechatronics: Slide 29Stefan Williams

    SHARC Internals:

    1540 Introduction To Mechatronics: Slide 30Stefan Williams

    SHARC Statistics:

    • Static Superscalar architecture optimizedfor Telecom Infrastructure

    • 2 billion 16-bit Memory Access Cycles at250 MHz

    • 12 GBytesper second of internal memorybandwidth for data and instructions

    • 600 MFLOPS (to 10 GFLOPS) processingpower (PC=10-20 MFLOPS)

    1540 Introduction To Mechatronics: Slide 31Stefan Williams

    When to use a DSP

    • Used when large repetitive computationsmust be performed in real-time.

    • Normally a DSP or array of DSPs are hostedby a PC or micro-controller 

    • Applications are mainly signal processing:speech, vision, radar.

    • http://www.analog.com/industry/dsp/overview /index.html

    1540 Introduction To Mechatronics: Slide 32Stefan Williams

    ASIC Chips

    • “Application Specific Integrated Circuit”

    • Perform a very specific function in hardware

    • Often combine the functionality of a number

    of other components in a single package

    • Can be used to lower production cost for highvolume applications

    • Hardware implementations are significantlyfaster than operations in software

  • 8/9/2019 6.Computing Mecatrónica

    9/159

    1540 Introduction To Mechatronics: Slide 33Stefan Williams

    Example ASIC : Entertainment

    • To lower productioncosts, the CPU,

    graphics and audioprocessors arecombined into a singleASIC.

    • The ASIC is acustomized chip createdto manage all of thecomponents that wouldotherwise be handled bythree separate chips.

    1540 Introduction To Mechatronics: Slide 34Stefan Williams

    Example ASIC : Multimedia

    • Provides highly-integratedsolutions for high-quality

    decoding of MPEG-1 andMPEG-2

    • Positioned as a cost-effectivesolution for streaming videoclients, set-top boxes, mediagateways and video endpoints,enabling manufacturers toeasily incorporate streamingvideo, DVD playback, video-on-demand and video over IP intotheir products

    1540 Introduction To Mechatronics: Slide 35Stefan Williams

    Example ASIC : Avionics

    • Analog ASICs used inavionics systems forEurofighter Typhoon. TheASIC realises the function

    of a dual LVDT receiver(Linear Variable DifferentialTransformer).

    • About 60 ASICs per aircraftare used in the FlightControl Computers and inthe pilot sticks to measurevarious mechanicalpositions and movements.

    1540 Introduction To Mechatronics: Slide 36Stefan Williams

    Field Programmable Gate Arrays

    (FPGA)

    • FPGAs consist of a (large) array of logicgates.

    • FPGAs are programmed by connectingsequences of gates together to provide

    required computation.

    • Programs consist of multiple threads of logic

    elements.

    • FPGA is then clocked, so running all gateseither in parallel or as a pipeline.

  • 8/9/2019 6.Computing Mecatrónica

    10/1510

    1540 Introduction To Mechatronics: Slide 37Stefan Williams

    An Array of Logic Gates:

    http://www.altera.com

    1540 Introduction To Mechatronics: Slide 38Stefan Williams

    Logic Array Block

    • The logic array containslogic array blocks(LABs) composed of 10logic elements (LEs)

    • Communicate through afully populated localinterconnect structure.

    1540 Introduction To Mechatronics: Slide 39Stefan Williams

    FPGA Performance Figures

    Table 1: FLEX6000 Performance 

    Benchmark Gates -1 Speed

    Grade

    -2 Speed Grade -3 Speed Grade

    16-bit loadable counter 16 172 MHz 153 MHz 133 MHz

    16-bit accumulator 16 172 MHz 153 MHz 133 MHz

    24-bit accumulator 24 136 MHz 123 MHz 108 MHz

    16-to-1 multiplexer 10 12.1 ns 13.4 ns 16.6 ns

    16 x 16 multiplier, 4 -stage pipeline 592 84 MHz 67 MHz 58 MHz

    8- bit, 16- tap parallel finite impulse response (FIR) filter 599 94 MSPS 80 MSPS 72 MSPS

    8-bit, 512 point fast Fourier transform (FFT) 1,166 75 µS63 MHz

    89 µS53 MHz

    109 µS43 MHhz

    a16450 universal asynchronous receiver/transmi tter (UART) 478 36 MHz 3 0 M Hz 25 MHz

    PCI bus target with one wait state 398 56 MHz 49 MHz 42 MHz

    1540 Introduction To Mechatronics: Slide 40Stefan Williams

    When to use an FPGA

    • FPGAs are used as a low-volume ASIC

    (application specific integrated circuit)

    • High-speed implementation of repetitive

    functions (I/O,signal processing,etc)• Parallel implementation of a range of

    functionalities.

    • FPGA can often be used to remove a great

    many support chips (even a whole board)

    • C++ programming (hardware compilation)

  • 8/9/2019 6.Computing Mecatrónica

    11/1511

    1540 Introduction To Mechatronics: Slide 41Stefan Williams

    Other Major Elements

    • A/D Converters

    • D/A Converters

    • Parallel Bus

    • Serial Bus

    1540 Introduction To Mechatronics: Slide 42Stefan Williams

    Analog to Digital Converter (ADC)

    • Take as input an analog signal• Sample signal and output a digital number 

    • Key Parameters:

     – Digital Resolution (8,10,12,16 bit)

     – Sampling frequency (100KHz-10MHz)

    • Input ranges normally +/-5 volts (may require

    amplification or scaling)

    1540 Introduction To Mechatronics: Slide 43Stefan Williams

    A/D Converters

    D0-D7

    Clock 

    SyncWrite

    ReadSet

    I  n t   e r f   a  c  e 

    Sample and Hold ADC

    Controller 

    Data Register 

    V+ V-

    Vref  Gnd

    Analog In

    Data to

    Computer 

    1540 Introduction To Mechatronics: Slide 44Stefan Williams

    Typical ADChttp://www.national.com/pf/AD/ADC12041.html

    On-Board Reference No

    Resolution 12 bits

    Conversion Time (us) 3.60

    Differential Input Yes

    Input Sample/Hold Yes

    Input Multiplexer 1

    Digital Interface Parallel

    Software Powerdown Yes

    Onboard Controller Yes

    Conversion Accuracy (LSB) 1

    ADC12041

  • 8/9/2019 6.Computing Mecatrónica

    12/1512

    1540 Introduction To Mechatronics: Slide 45Stefan Williams

    ADC Specification

    (f CLK

    = 12 MHz)

    Resolution 12-bits + sign

    13-bit conversion time 3.6 µs, max

    13-bit throughput rate 216 ksamples/s , min

    Integral Linearity Error (ILE) ±1 LSB, max

    Single supply +5V ± 10%

    VIN

    range GND to VA+

    1540 Introduction To Mechatronics: Slide 46Stefan Williams

    Digital to Analog Converter (DAC)

    • Take input (from computer) as a digital

    number 

    • Output an analog signal proportional to

    digital number 

    • Key Parameters:

     – Digital Resolution (8 bit usually)

     – Settling time

    • Output range normally 0-5 volts (subsequentscaling and amplification)

    1540 Introduction To Mechatronics: Slide 47Stefan Williams

    DAC

    Digital

    Input

    Vout

    GroundDAC

    http://www.national.com/ds/DA/DAC0800.pdf 

    1540 Introduction To Mechatronics: Slide 48Stefan Williams

    DAC Performance

    Parametric Table

    Resolution 8-Bit

    Settling Time to 1/2 LSB(ns)

    100

    Number of Channels 1

    Digital Interface parallel

    Supply Voltage ± 5 V to ± 15 V

    •Nonlinearity over temperature:±0.1%•Full scale current drift: ±10

    ppm/°C•High output compliance: -10Vto +18V•Complementary currentoutputs•Interface directly with TTLWidepower supply range: ±4.5V to±18V•Low power consumption: 33mWLow cost

  • 8/9/2019 6.Computing Mecatrónica

    13/1513

    1540 Introduction To Mechatronics: Slide 49Stefan Williams

    Parallel I/O

    • Programmable Interface Chip:

     – Bus interface, typically 8-bit

     – Control lines - CS, OE, WE, Reset

     – A few address lines - A0, A1

     – Special-purpose internal registers for controland status

    • Direct Memory Access (DMA)

    1540 Introduction To Mechatronics: Slide 50Stefan Williams

    8255 PPI(Programmable Peripheral Interface)

    1540 Introduction To Mechatronics: Slide 51Stefan Williams

    Memory-mapped I/O

    • Memory locations appear as I/O ports

    • No separate instructions to access I/O

    devices

     – eg LD operates on memory & I/O• CPU and I/O devices can share memory

    D0-D7

     A0-A15

    R/W

    CPU

    1540 Introduction To Mechatronics: Slide 52Stefan Williams

    Serial I/O

    • Parallel data words, put out on a clocked

    single (serial) line.

    Drivers

    D0-D7Data

    A0-A16

    Address

    Clock 

    Serial

    Line

    Ready

    Tx/Rx

     S  e r i   a l  Dr i   v e r 

  • 8/9/2019 6.Computing Mecatrónica

    14/1514

    1540 Introduction To Mechatronics: Slide 53Stefan Williams

    Serial I/O

    • Many Standards:

     – RS232

     – RS424

     – CAN (automotive)

     – USD

    • Many implementations:

     – Twisted pair 

     – Fibre

     – Coax

    1540 Introduction To Mechatronics: Slide 54Stefan Williams

    Algorithms for Embedded Systems

    • Key attributes (differences between

    embedded and normal code):

     – Real Time

     – Interface to real devices

     – Robust to component failure

     – Robust to self-failure

    1540 Introduction To Mechatronics: Slide 55Stefan Williams

    Real Time

    • Able to perform calculations by a time deadline

    • Tie calculations to physical external timers

    Initialise_Loop();TICK=Sample_interval;

    Out_Time=TICK+get_time();Loop:

    time=get_time();output=calculations(time);

    wait_until(Out_Time);write(output);

    Out_Time=Out_Time+TICK;End Loop;

    1540 Introduction To Mechatronics: Slide 56Stefan Williams

    Device Interface

    • Device independence (Device Drivers)

    • Timing/resource issues with device

    Get_address();Format_message();

    Loop:Transmit(byte);

    Acknowledge();End Loop:

    ……

    Write(Output);

    ……

    User CodeDevice Driver 

    Hardware and Software Device

    Sensor ?

  • 8/9/2019 6.Computing Mecatrónica

    15/1515

    1540 Introduction To Mechatronics: Slide 57Stefan Williams

    Component Failure

    • Check that components are operational

    • Fail in some safe manner 

    If(write(output)==FAIL) {

    apply_brakes(Now);flash_lights(red);

    enable_panic_mode();}

    Else {flash_lights(green);

    pulse(No_Worries);}

    Something

    Is Broken

    1540 Introduction To Mechatronics: Slide 58Stefan Williams

    Self Failure

    • The most common failure mode is software

    • Use of heart-beat signal or watch-dog timer

    • Heart beat ties all system components together 

    Loop:

    output=calculations(time);wait_until(Out_Time);

    write(output);Out_Time=Out_Time+TICK;

    Signal_watch_dog(1);End Loop;

    System

    Power In

     NormallyOpen Switch

    ‘Keep Closed’

    Signal

    1540 Introduction To Mechatronics: Slide 59Stefan Williams

    Computing: Summary

    1. Embedded Computing Systems

    2. Embedded Systems Processors

    3. Input and Output

    4. Communications

    5. Real-time algorithms