450 likes | 1.24k Views
Microcontroller based system design. Asst. Prof. Dr. Alper ŞİŞMAN. Course Objectives. to develop an in- depth understanding of the operation of microprocessors and microcontrollers C language platform for embedded systems microcontroller interfacing techniques
E N D
Microcontroller based system design Asst. Prof. Dr. Alper ŞİŞMAN
Course Objectives • todevelop an in-depthunderstanding of • theoperation of microprocessorsandmicrocontrollers • C language platform forembeddedsystems • microcontrollerinterfacingtechniques • Thepath an embeddedsystem, design&implementation of embeddedsystems in both hardware and software • to be abletouse ST32F4 serieshighperformance 32-bit ARM (Advanced RISC Machine) basedmicrocontrollers.
Outline • Microcontroller basics and programming concepts,basic architecture. • <Exercise: The compiler and its capabilities, simulation, debugging examples> • Programming Model, AddressingModesandInstruction Set • <Exercise: LED on/off> • Interfacing concepts, IO module • <Exercise: push button,7-segment, keypad connection and alphanumeric display examples>
Timer and ADC modules • <Exercise: Data acquisition and control examples> • TheStack, SubroutinesandInterrupts • <Exercise: Use of external and timer interrupts> • Serial communications, Universal async. Receive/transmit (UART) • <Exercise: An UART application> • Serial communication , I2C and SPI • <Exercise: An I2C application>
Commoncomputerorganization (simplifiedview) • ALU (Arithmetic Logic Unit) is a circuitry, which is capable of doing various operations (for example ADD, SHIFT, AND, OR, etc) on certain on-chip registers. • CPU (Central Processing Unit) is the combination of the control logic, associated registers and the arithmetic logic unit.
CPU structure • The main functionsare • data transfer • arithmeticandlogicoperations • decisionmaking (instructionalflowcontrol) • Theregisterarrayconsists of at leastoneaccumulator, program counterandstackpointer • Thecontrolunitcontrolsalltheoperations in a CPU andbasically it putsthe CPU in one of thefetchandexecutionphases
Memory Input/Output (I/O) ALU Control CPU
Computer Buses • Addressbus: carriestheaddress of a uniquememoryorinput/output (I/O) device • Data bus: carries data stored in memory (or an I/O device) tothe CPU orfromthe CPU tothememory (or I/O device) • Control bus: is a collection of controlsignalsthatcoordinateandsynchronizethewholesystem
Memory • Thememory in a computersystemstoresthe data andinstructions of theprograms. Adress decoder Storage Area Data bus Adress bus Othersignals (Vcc,Gnd, CS, etc.)
Main memory types • ROM (read-onlymemory) • programmedpermanently at thefactory, cannot be altered • RAM (random-accessmemory) • readandwritememory • EPROM (erasableprogrammable ROM) • nonvolatile, writtenelectrically but erasedoptically • EEPROM (electrically ROM) • nonvolatile, bothwrittenanderasedelectrically
Operation of CPU • Fetchcycle (phase): • The CPU putstheaddress of theinstructionto be executed on theaddressbus. Theaddressinfocomesfromthe program counter (PC) maintainedbythecontrolunit. • Thecontrolbusholdstheinfo. forreadingthememorylocationandthe data busholdstheinstructionfromthememorywhich is storedintotheinstructionregister (IR) • PC is updatedtopointtothenextinstruction.
Executecycle (phase): • Instruction in the IR is decoded • Therequired data transfer andtherequiredlogicalandarithmeticoperationareperformed • Theresult is writtenbackeithertoone of theregistersormemoryor I/O device • Commonoperationsperformed in ALU are: • addition, subtraction, • logical AND, OR, XOR, NOT • increment, decrement, shift, clear, etc.
Microcomputer/Microcontroller • CPU on a single ICmicroprocessor (µP). • the terms CPU, µP and MPU (microprocessor unit) are synonymous. • CPU is the combination of the ALU and control unit of any computer. • When the CPU is a single IC; it is called a µP and is alsoreferred to as the MPU. • When the MPU‘s connected to memory and I/O, the arrangement becomes a MICROCOMPUTER. • What is microcontroller?: A microcontroller unit (MCU) contains an MPU, memory, and I/O circuitry on a single chip.
Microprocessorvsmicrocontroller • Microprocessors: high performance, general purpose “brains” for PCs and workstations • Instruction decode and control, arithmetic/logicoperations, registers, timing, external control • Typical cost: $75 -- $500 • Annual demand: 10s of millions • Microcontrollers: devices with high levels ofintegration for embedded control • Microprocessor functions plus on-chip memory andperipheral functions (e.g. ports, timers) • "Swiss army knife" of microprocessor technology • Typical cost: $1-- $25 • Annual demand: billions!
Embedded System • The majority of microcontrollers in use today are embedded in other machinery, such as automobiles, telephones, appliances, and peripherals for computer systems. These are called embedded system. • Typical input and output devices include switches, relay, solenoids, LEDs, small or custom LCD displays, radio frequency devices, and sensors for data such as temperature, humidity, light level etc. • Embedded systems usually have no keyboard, screen, disks, printers, or other recognizable I/O devices of a personal computer, and may lack human interaction devices of any kind.