Microprocessor Systems Networks and Embedded Software Module 4.1.1 by Wolfgang Neff
Components (1) Microprocessor System Microprocessor (CPU) Memory Peripherals Control Bus Address Bus Data Bus 2
Components(2) Microcontroller / System on a Chip Peripheral Microcontroller Port Port Microprocessor Memory Interfaces 3
Components (3) Microprocessor (details: module 4.1.2) Execution Unit Control Unit Registers ALU Bus Interface Unit Control Bus Address Bus Data Bus 4
Instructions Data Components (4) Information Flow Execution Unit Storage Control Unit Microprocessor Registers ALU 007h 006h 005h 004h 003h 002h 001h 000h Bus 5
Memory (1) Memory Access Microprocessor Microprocessor Address = 002h Data = 4 Write = 1 Compiler stuff (not in storage) Name y x Memory Cell Address 0 003h 0 002h 0 001h 0 000h Address = 002h Data = 4 Read = 1 Memory Name Cell Address 0 003h y 4 002h x 0 001h 0 000h 6
Memory (2) Harvard Architecture One storage for instructions Another storage for data Memory Instructions Microprocessor Memory Data 7
Memory (3) Von Neumann Architecture Common storage for instructions and data Sometimes segmented Memory Microprocessor Data Instructions Data Segment Program Segment 8
Memory (4) Memory Hierarchy Motto: the faster the smaller Data is copied between different hierarchies Heavily used data is close to the microprocessor Registers Cache Main Memory Secondary Memory Superfast Very expensive Tiny Very fast Expensive Small Fast Moderate Reasonable Slow Cheap Large 9
Memory (5) Memory Layout Static Data Dynamic Data Code Data Heap Stack Usually immutable Fixed in size, content may change Free and used memory blocks, dynamic allocation Grows and shrinks as needed 10
Memory (6) Loading a program class Complex { }; int inc(int) { }; int i; int main() { Complex z(1,2); i = inc(5); z = z+i; } i = inc(5); z = z+i; int i; Complex z; «return» Code comes here Variables come here Objects come here Function calls come here 11
Peripherals (1) Examples Computers Storage: hard disk drive, SSD Input devices: keyboard, mouse Output devices: monitor, printer, speaker Mobile Phone Storage: flash, SD memory card Input devices: touch screen, camera Further devices: accelerometer, GPS 12
Peripherals (2) Characteristics Independent devices Have their own controller Have their own register set Data exchange necessary Host/Device connection Connected via interface Operate asynchronously Device acts independently from host 13
Peripherals (3) Architecture Software Operating System Device Driver Hardware Data Control Registers Controller Status Peripheral 14
Peripherals (4) Register Set Data Register Used to transfer data to and from the device Example: the text a printer should print Control Register Tells the device what to do Example: print out a color copy, for example Status Register Reports what the device is doing Example: printer has stopped as it is out of paper 15
Interfaces (1) Definitions Port: Pins used by the interface Module: Hardware that implements the interface Examples Digital Ports: GPIO (module 4.2.1) Analog Ports: ADC, DAC (module 4.2.6) Serial Ports: UART, SPI, I 2 C, CAN, USB, Ethernet, (modules 4.2.6 and 5.2.4) 16
Interfaces (2) Modules Microcontrollers have multiple modules ATmega1284: 4 GPIO, 8 ADC, 2 USART, 1 SPI, ATmega4809 : 6 GPIO, 16 ADC, 4 USART, 1 SPI, ATxmega128A1: 11 GPIO, 16 ADC, 8 USART, 4 SPI, Labeling the individual modules Enumeration by numbers: 0, 1, 2, 3, Enumeration by letters: A, B, C, D, 17
Interfaces (3) Modules (continued) Module Type (USART) Module 0 (USART0) Module 1 (USART1) Module 2 (USART2) Data Control Status Data Control Status Data Control Status 18
Interfaces (4) Communication Polling Device is polled if it is ready to receive data Device is polled if new data is available Microprocessor Device ready? Yes/no Device 19
Interfaces (5) Communication (continued) Interrupt Device indicates that it is ready receive data Device indicates that new data is available Microprocessor Device/data ready Indicator line Device 20