Programming Microcontroller

Slides:



Advertisements
Similar presentations
Computer Organization and Architecture
Advertisements

©Brooks/Cole, 2003 Chapter 5 Computer Organization.
Computer Organization and Architecture
Basic Computer Organization CH-4 Richard Gomez 6/14/01 Computer Science Quote: John Von Neumann If people do not believe that mathematics is simple, it.
Engineering 1040: Mechanisms & Electric Circuits Fall 2011 Introduction to Embedded Systems.
1 © Unitec New Zealand Embedded Hardware ETEC 6416 Date: - 10 Aug,2011.
C.S. Choy95 COMPUTER ORGANIZATION Logic Design Skill to design digital components JAVA Language Skill to program a computer Computer Organization Skill.
Arduino Josh Villbrandt February 4, Digital Circuits Analog versus digital – What’s the difference? – How to represent an analog signal in a computer?
Introduction to Computing: Lecture 4
Revised: Aug 1, ECE 263 Embedded System Design Lesson 1 68HC12 Overview.
Random access memory.
1 CS503: Operating Systems Spring 2014 Dongyan Xu Department of Computer Science Purdue University.
CHAPTER 3 TOP LEVEL VIEW OF COMPUTER FUNCTION AND INTERCONNECTION
SKILL AREA: 1.2 MAIN ELEMENTS OF A PERSONAL COMPUTER.
Memory Cell Operation.
ATtiny23131 A SEMINAR ON AVR MICROCONTROLLER ATtiny2313.
Computer Hardware A computer is made of internal components Central Processor Unit Internal External and external components.
Computer Architecture Lecture 24 Fasih ur Rehman.
Overview von Neumann Architecture Computer component Computer function
Semiconductor Memory Types
Computer operation is of how the different parts of a computer system work together to perform a task.
RAM RAM - random access memory RAM (pronounced ramm) random access memory, a type of computer memory that can be accessed randomly;
Index What is an Interface Pins of 8085 used in Interfacing Memory – Microprocessor Interface I/O – Microprocessor Interface Basic RAM Cells Stack Memory.
USING TV REMOTE AS A CORDLESS MOUSE FOR THE COMPUTER
Chapter 2 content Basic organization of computer What is motherboard
Introduction to Microcontroller Technology
Systems Architecture Keywords Fetch Execute Cycle
Popular Microcontrollers and their Selection by Lachit Dutta
Embedded Systems Programming
Chapter 5 Internal Memory
William Stallings Computer Organization and Architecture 7th Edition
Atmega32 Architectural Overview
Microcontrollers & GPIO
Sistem Mikroprosesor 1. Blok Diagram Minimum System(CPU,ROM,RAM)
Computer Hardware – System Unit
Edexcel GCSE Computer Science Topic 15 - The Processor (CPU)
PC Mouse operated Electrical Load Control Using VB Application
UNIT – Microcontroller.
Programming Microcontroller ADC – Analog Digital Converter
Introduction of microprocessor
Memory Units Memories store data in units from one to eight bits. The most common unit is the byte, which by definition is 8 bits. Computer memories are.
CS-301 Introduction to Computing Lecture 17
William Stallings Computer Organization and Architecture 7th Edition
Basic Computer Organization
Programming Microcontroller GPIO – General Purpose Input/Output
An Introduction to Microprocessor Architecture using intel 8085 as a classic processor
Microcontroller Intel 8051
William Stallings Computer Organization and Architecture 8th Edition
Introduction to Microprocessors and Microcontrollers
Computer Organization
William Stallings Computer Organization and Architecture 7th Edition
Introduction to Computing
William Stallings Computer Organization and Architecture 8th Edition
Morgan Kaufmann Publishers Computer Organization and Assembly Language
BIC 10503: COMPUTER ARCHITECTURE
Introduction to Computing Chapter 0
Today’s agenda Hardware architecture and runtime system
Components of a CPU AS Computing - F451.
AVR – ATmega103(ATMEL) Architecture & Summary
MICROPROCESSOR MEMORY ORGANIZATION
A451: Computer Systems and Programming
Chapter 5 Computer Organization
William Stallings Computer Organization and Architecture 8th Edition
ADSP 21065L.
Computer Operation 6/22/2019.
Presentation transcript:

Programming Microcontroller uC System 2- 1 Programming Microcontroller uC System Week 1 – Spring Term 2017 32K Byte Burst Flash 64K or 96K Byte SRAM 256K or 512K Byte Burst Flash OTP Mem UART I2C SPI TIM RTC EXT. Bus GPIO USB 2.0FS CAN 2.0B Enet MAC PFQ BC DMA INTR Cntl ARM966E CORE w/DSP 96 MHz CLK Cntl ADC LVD BOD PLL JTAG ETM9

Architecture of uC Systems 2- 2 Only one address space Program instruction Program memory (ROM) Program data Data memory (RAM) Instruction and data are accessed sequentially Information exchange runs over the same bus Program memory Data Periphery CPU

Central Processing Unit uC System Central Processing Unit 2- 3 Core of the computer Interpret the program instructions and process of the data

Control unit is responsible for the execution of the program uC System 2- 4 Control unit is responsible for the execution of the program Instruction unit Interpret and execute the program instructions Program counter Contains the address of the next instruction Task of the control unit Load the program instructions (fetch) Decode the program instructions (decode) Execute the program instructions (execute) Generate the control signals for the other units Address and load the operands Store the result Adapt the program counter

Processing unit contains the following components uC System Processing unit Processing unit contains the following components ALU (Arithmetic Logical Unit) Execute arithmetic and logical operations FPU (Floating Point Unit) Execute floating point operations Register Store the operands and the result Bus interface Activation of the external units Internal bus connects the control unit, processing unit and the bus interface

uC System Bus system 2- 6

The components of the bus system uC System The components of the bus system Address Bus Transfer of address information Use of additional address decoders Data Bus Transfer of program instructions and user data CPU reads from the external units CPU writes in the external units Control Bus Additional control informations Read, Write, Reset, Interrupts, Requests, Acknowledge …

Read the temperature from the sensor “x” uC System Example 2- 8 Read the temperature from the sensor “x” Store its value into the variable “temp” int temp = Temperature_Sensor_x;

Data Transfer CPU sets the address of the program instruction uC System Data Transfer 2- 9 CPU sets the address of the program instruction CPU defines the transfer direction read Program memory outputs the instruction on the data bus CPU reads the instruction to be executed CPU sets the address of the temperature register Peripherals outputs the information to the data bus CPU reads the value of the temperature CPU sets the address of the variable temp CPU defines the transfer direction write CPU places the data on the data bus Data memory takes the data from the data bus

Plan of the memory allocations in a microcontroller system uC System Memory-Map 2- 10 Plan of the memory allocations in a microcontroller system Address fields of the memory components Address fields of the peripheral components Example   Adresse A15 A14 A13 A12 Periphery 0xFFFF 1 0xE000 Not used RAM (8kByte)  0xBFFF 0xA000 0x9FFF 0x8000 ROM (32kByte) 0x7FFF

Non-volatile Memory types uC System Memory 2- 11 Non-volatile memory The contents remain after switching off Non-volatile Memory types ROM (Read Only Memory) Masks programmed EPROM (Erasable Programmable ROM) Special programming devices Can be erased with UV light EEPROM (Electrical Erasable Programmable ROM) Electrically erasable and reprogrammable (line by line) Small storage capacity (~ kByte) FLASH Electrically erasable (block by block) Very large storage capacity (~ MByte)

Memory Volatile memory Volatile Memory types uC System Memory 2- 12 Volatile memory The memory contents are lost after switching off Volatile Memory types RAM (Random Access Memory) DRAM (Dynamic RAM) Keep the information in a capacity Must be periodically refreshed SRAM (Static RAM) Complex construction Do not need a refresh cycle SDRAM (Synchronous Dynamic RAM) Clocked variant of the DRAM Clock is specified by the system bus

Each storage technology has its advantages and disadvantages uC System Memory hierarchy 2- 13 Each storage technology has its advantages and disadvantages Memory is therefore organized hierarchically

Fast intermediate memory for frequently required data Cache uC System 2- 14 Fast intermediate memory for frequently required data Between register and memory CPU reads code or data from memory These objects are automatically stored in the cache These objects are read by the cache next Data does not exist in the cache => Cache Miss Data is read from memory and stored in the cache Data is in the cache => Cache Hit Data is read from the cache Cache are typically 100K bytes

Memory for program code (Flash) and data (RAM) PC world uC System Working memory 2- 15 Memory for program code (Flash) and data (RAM) PC world Code is copied from the mass storage into the working memory and executed from there Embedded world Code is executed from Flash Code is copied from flash into the working memory and run from there

Mass storage devices are hard disks, CD, memory sticks etc. uC System Mass storage 2- 16 Mass storage devices are hard disks, CD, memory sticks etc. Embedded system do not contain mass storage Mass storage, however, are found in industrial PCs Following storage media are used because of the mechanical environment CF cards SD cards Memory Sticks

uC System Periphery components 2- 17 The following components are referred to as peripherals Reading external data (sensors) Data output (actuators) Interface between processor and environment Connection to the processor bus

Input and output of digital signals uC System Digital Input / Output 2- 18 Input and output of digital signals Microcontroller Pins (GPIO) Access via register Use of additional peripherals (FPGA, PIO, ...) Access via bus system Use of digital output Indicators (lamps, LEDs, ...) Relay Motor Valves Use of digital input switch Buttons Optocoupler

Digital outputs are used with amplifier stages Using GPIO uC System 2- 19 Digital outputs are used with amplifier stages Control of motors Valves Digital inputs are filtered and protected against overvoltage RC links & Schmitt triggers Transzorb diodes, varistors and gaseous conductors

Data transmission is realized with a serial bit stream uC System Serial interface 2- 20 Data transmission is realized with a serial bit stream RS232, I2C, SPI, FireWire, USB, Fieldbus, ... Convert data format from parallel to serial with shift register Main characteristics Baud rate, voltage level & protocol

Very common in the embedded area uC System RS232 2- 21 Very common in the embedded area Use with LCD display, CLI (Command Line Interface), ... Many microcontrollers already have an RS232 Output level is however TTL RS232 are addressed via registers Send & receive buffer Often both buffers are at the same address Control register for defining the operating mode Baud rate, data, parity, interrupt, ... RS232 Support different modes Asynchronous or synchronous Timer often generates the baud rate

SPI is a serial high-speed bus system uC System SPI 2- 22 SPI is a serial high-speed bus system Use with display, A/D and D/A converters SPI is always operated in the master slave Master is responsible for the clock SPI works full duplex MOSI and MISO

SPI with a Master and 2 Slaves uC System SPI with a Master and 2 Slaves 2- 23

Time basis for the processor or for external components Timer uC System 2- 24 Time basis for the processor or for external components PWM, baud rate for serial interfaces Use of 8 or 16 Bit Timer/Counter Timer operation Timer register is incremented by oscillator Counter operation Timer register is incremented by external signal Overflows of register set a flag signal

Generation of a clock with a defined period duration Timer uC System 2- 25 Generation of a clock with a defined period duration Timer with auto reload

Analog voltage  Digital value Most important characteristics A/D Converter uC System 2- 26 Analog voltage  Digital value Reading in the result with bus system or serial interface Most important characteristics Size of the result (8, 10, 12 or 16 bits) and conversion time

Digital value  Analog voltage Most important characteristics D/A Converter uC System 2- 27 Digital value  Analog voltage Most important characteristics Bit width of the digital value (8, 10, 12 or 16 bits) Conversion time