130 likes | 232 Views
Lecture 1: Introduction, Embedded Sys, Product Life-Cycle, 9S12 Programming. EE 319K Introduction to Microcontrollers. My Shpeel.
E N D
Ramesh Yerraballi Lecture 1: Introduction, Embedded Sys, Product Life-Cycle, 9S12 Programming EE 319KIntroduction to Microcontrollers
Ramesh Yerraballi My Shpeel • “It is important that students bring a certain ragamuffin barefoot irreverence to their studies, they are here not to worship the known but to question it” – Jacob Bronowski • How much do you pay for a Burger? • Per lecture?
Ramesh Yerraballi Agenda • Course Description • Book, Labs, Equipment • Grading Criteria • TAs • Expectations/Responsibilities • Embedded Systems • Product Life Cycle • Analysis, Design, Implementation, Testing • Flowcharts, Data-Flow and Call Graphs • 9S12 Programming
Ramesh Yerraballi Embedded System • Embedded Systems are everywhere but mostly hidden • MicroProcessor • Intel: 4004, ..8080,.. x86 • Motorola: 6800, .. 6812,.. PowerPC • ARM, DEC,SPARC, Natl Semi.,… • MicroController • Processor+Memory+I/O Ports (Interfaces)
Ramesh Yerraballi Microcontroller • Memory • Non-Volatile • ROM • EPROM, EEPROM, Flash • Volatile • RAM (DRAM, SRAM) • Interfaces • H/W: Ports • S/W: Device Driver • Parallel, Serial, Analog, Time
Ramesh Yerraballi Flowchart • Example 1.1: Design a flowchart for a system that performs two independent tasks. The first task is to output a pulse on PTT every 1.024 ms in real time. The second task is to find all the prime numbers, and there are no particular time constraints on when or how fast one finds the prime numbers.
Ramesh Yerraballi Structured Programming • Common Constructs (as Flowcharts)
Ramesh Yerraballi Implementation(Real) Hardware, Software Testing (Works?) Validation:Correctness Performance: Efficiency Maintenance (Improve) Product Life Cycle • Analysis (What?) • Requirements -> Specifications • Design (How?) • High-Level: Block Diagrams • Engineering: Algorithms, Data Structures, Interfacing
Ramesh Yerraballi Data Flow Graph • Position Measurement System
Ramesh Yerraballi Call Flow Graph • Position Measurement System
Ramesh Yerraballi 9S12 Assembly Programming • 9S12DP512 • 9S12DG128
Ramesh Yerraballi Registers 9S12 has 6 registers
Ramesh Yerraballi Some Basic Instructions ldaa #10 ;make A=10 ldaa $3800 ;A=contents of memory staa $3800 ;Store contents of A ;into mem deca ;A=A-1 lsra ;A=A/2 (shift right) lsla ;A=A*2 (shift left) adda #10 ;A=A+10 anda #$02 ;A=A&2 (logic and) eora #$08 ;A=A^8 (exclusive or) oraa #$03 ;A=A|3 (logic or) bra loop ;always jump to loop bne loop ;jump to loop if ; not zero beq loop ;jump to loop if zero stop 9S12 Programming • Simple Program • org $3800 • count rmb 1 • org $4000 • mainldaa #10 ;loop counter • staa count • loopdec count ; 9,8,… 0 • bne loop • stop • org $FFFE • fdb main