Presentation is loading. Please wait.

Presentation is loading. Please wait.

Department of Electronic & Electrical Engineering Embedded system Aims: Introduction to: Hardware. Software Ideas for projects ? Robotics/Control/Sensors.

Similar presentations


Presentation on theme: "Department of Electronic & Electrical Engineering Embedded system Aims: Introduction to: Hardware. Software Ideas for projects ? Robotics/Control/Sensors."— Presentation transcript:

1 Department of Electronic & Electrical Engineering Embedded system Aims: Introduction to: Hardware. Software Ideas for projects ? Robotics/Control/Sensors DEMO

2 Department of Electronic & Electrical Engineering Content: What is a microcontroller. Architecture (what is on the chip and how it is connected). IO (how we interact with the chip) Applications PIC16F84A (example microcontroller) Machine code / Assembly code. MPLABX (programming environment) PICKIT3 hardware to program the PIC Single board computers High level languages

3 Department of Electronic & Electrical Engineering What is a microcontroller? It is a computer on a single chip. Processing unit Memory Input / output Typically used in an embedded system (no need to reprogram)

4 Department of Electronic & Electrical Engineering Applications ● Car industry ● Telephones ● Appliances ● Cameras ● Displays ● Gadgets ● Remote controls ● Student projects

5 Department of Electronic & Electrical Engineering Typical Input and output ● Switches ● LEDs ● LCD ● Sensors(light, sound, humidity, position ) ● Analogue signals -> ADC->digital ● DAC -> analogue output ● Control Power Electronics

6 Department of Electronic & Electrical Engineering Example --- PIC16F84A Made by Microchip Technology P eripheral I nterface C ontroller Example: low end device PIC16F84A. ● Simple ( 35 instructions RISC ) ● Cheap ( ~ £3 ) ● Robust (I haven't broken one yet!!!)

7 Department of Electronic & Electrical Engineering PIC 16F84A pin layout

8 Department of Electronic & Electrical Engineering Summary of pins OSC1/CLKIN: Oscillator crystal input. OSC2/CLKOUT: Oscillator crystal output. MCLR(inv): Master clear(reset)input. Programming voltage input. RA0 - RA3: Bi-directional I/O port. RA4/T0CKI: Bi-directional I/O port. Clock input to the TMR0 timer. RB0/INT : Bi-directional I/O port. External interrupt pin. RB1 - RB7: Bi-directional I/O port. VSS: Ground VDD: Positive supply(+2.0V to +5.5V)

9

10 Department of Electronic & Electrical Engineering PIC development. Programmer Development Board

11 Department of Electronic & Electrical Engineering Schematic for development board 4MHz Oscillator Program /Run

12 Department of Electronic & Electrical Engineering

13

14 Machine Instructions (PIC16F84A) ● Each instruction is 14 bits ● For example 000010 0 0100000 ● 000010 --- subtract the contents of a register from W ● 0 --- were we put result (W or file register) ● 010000 --- which register

15 Department of Electronic & Electrical Engineering Assembly code We would go mad trying to program in machine code so we use ASSEMBLY CODE For example 000010 0 0100000 is written as subwf 20h, w Subtract W from register number 20h and put the result in W. A program called an assembler converters assembly code into machine code (MPLABX uses mpasm).

16 Department of Electronic & Electrical Engineering Simple program We we want to do: NUM_2 = NUM_1 + 101; Assembly code: NUM_1 EQU 15 ; address of file register NUM_2 EQU 16 movf NUM_1,w ; Copy the variable NUM_1 to W addlw D'101' ; Add the literal constant 101 decimal to it movwf NUM_2 ; Copy NUM_1+101 into NUM_2 Machine code: 001000 0 0001111 111110 0 1100101 000000 1 0010000

17 Department of Electronic & Electrical Engineering input->PORTA PORTB ->output

18 Department of Electronic & Electrical Engineering Example: copying data from portA to portB bsf STATUS,5 ;select bank 1 movlw B'00000000' ;set up port B as all outputs movwf TRISB movlw B'00001111' ;set up port A 0-3 as inputs movwf TRISA bcf STATUS,5 ;select bank 0 loop movfw PORTA ; input PORTA movwf PORTB ; output to PORTB goto loop ; loop forever end

19 Department of Electronic & Electrical Engineering Voltmeter demo.

20 Department of Electronic & Electrical Engineering Other Microchip devices

21 Department of Electronic & Electrical Engineering Typical Features of microcontrollers. ● GPIO (general purpose IO pins) ● Interfaces: ● SPI I2C UART Ethernet USB ● PWM generators (motor control) ● ADC (less common DAC) ● Signal processing ● Timers ● Interrupts

22 Department of Electronic & Electrical Engineering Some manufacturers Microchip PIC8 PIC10... PIC32 ● Texas Instruments e.g. MSP430 signal processing ● Atmel AVR general purpose ARM (Samsung tablet)

23 Department of Electronic & Electrical Engineering High level languages Different devices have different: ● Architectures ● Instruction sets A compiler can translates a high level language program (e.g. C C++...) into machine code for the target device – Still need to understand the device architecture to do Input/Output

24 Department of Electronic & Electrical Engineering Single board computers? Microprocessor / microcontroller + Other chips on the board maybe: memory IO ADC etc

25 Department of Electronic & Electrical Engineering Arduino.. is an open-source electronics prototyping platform ● Various boards (different manufacturers) ● Open source IDE (Linux, Windows, mac OS X) ● High level C++ based programming language. ● Libraries to help you do things like input/output !!!!

26 Department of Electronic & Electrical Engineering Arduino IDE Showing how easy it is to write to the LCD display!

27 Department of Electronic & Electrical Engineering Odroid-X2 (quad core arm 1.7GHz) This is the processor that drives samsung tablet. Android Linux

28 Department of Electronic & Electrical Engineering Summary Microcontroller chips. Cheap £3-20 Can be programmed in assembly or C,C++ etc Need a programmer e.g. PICKIT3 (expensive 30-70 pounds) Single board computers. Arduino About £16 but has bootstrap program so no programmer required. High level programming. Ideal for student projects – control – sensors Rasp-PI/Beagleboard/Odroid £30-150 Linux/Android OS Typically no built in ADC but general purpose digital IO


Download ppt "Department of Electronic & Electrical Engineering Embedded system Aims: Introduction to: Hardware. Software Ideas for projects ? Robotics/Control/Sensors."

Similar presentations


Ads by Google