Microcontroller VU
|
|
- Julius Davidson
- 6 years ago
- Views:
Transcription
1 Microcontroller VU Martin Perner SS 2017 Featuring Today: A Deep Look into the Processor Core Getting Code onto the Microcontroller Chip Weekly Training Objective This week 1.2 Board test Assembler demo program Makefile Logical operations Next week Input with floating pins Monoflop buttons Digital I/O precompiled LCD Until Exam LED Rain LED curtain Calling conventions I Calling conventions II Martin Perner Microcontroller Basics March 6, Organizational Stuff Make your slot suggestions in myti ( Martin Perner Microcontroller Basics March 6, Use the lab!
2 Organizational Stuff Slots The Tutors will be in the lab for 3 hours at a time. Check for the exact times. Your slot suggestions are for one hour in the lab, during a tutor slot. During your assigned slot you have priority for a microcontroller-target. Nonetheless, you can work at any time in the lab (not limited to tutor hours), given that the lab is open. Check the timetable on the TILab homepage! Martin Perner Microcontroller Basics March 6, A Deep Look into the Processor Core We are using Atmel AVR microcontroller in lab Overview not restricted to AVR Every microcontroller works nearly the same In-depth knowledge of a CPU inner workings are taught in Computer Organzation and Design (3. semester BTI) AVR Core Martin Perner Microcontroller Basics March 6, Martin Perner Microcontroller Basics March 6,
3 A Microcontroller Executable Motorola S-Record File: (*.srec) S00C D6F2E S C940C002F93202F015618F F07E S F2F FEF0DBF01E20EBF62 S E002B90FEF01B904E40EBB00E00FBB1E S F00E B90C941800C6 S C C6C6F20576F726C6421AF S A S FC Is a printable form of an exe file for a microcontroller. Martin Perner Microcontroller Basics March 6, Motorola S-Record Format Record Type (S1) S0 Block Header S1-3 Data Records S5 Record Count S7-9 End of Block S C940C002F93202F015618F F07E Byte Count (0x13) Address + Data + Checksum Address (0x0000) Data (only for S0-3) Checksum (0x7E) (ones complement of the sum of: byte count, address bytes, and data bytes) & 0xFF Martin Perner Microcontroller Basics March 6, A Microcontroller Executable Intel Hex File: (*.hex) : C940C002F93202F015618F F082 : F2F FEF0DBF01E20EBF66 : E002B90FEF01B904E40EBB00E00FBB22 : F00E B90C941800CA : C C6C6F20576F726C6421B3 : E : FF Same data, other format. Martin Perner Microcontroller Basics March 6,
4 Intel Hex Format Start Code (:) Byte Count (0x10) Data only Address (0x0000) Record Type (00) 00 Data Records 01 EOF Record... Data : C940C002F93202F015618F F082 Checksum (0x82) (two s complement of the sum of: byte count, address bytes, record type, and data bytes) & 0xFF AVR Core Martin Perner Microcontroller Basics March 6, Instructions Martin Perner Microcontroller Basics March 6, : C940C002F93202F015618F F082 : F2F FEF0DBF01E20EBF66 : E002B90FEF01B904E40EBB00E00FBB22 : F00E B90C941800CA : C C6C6F20576F726C6421B3 : E : FF AVR Instructions 16/32 bit opcodes Instructions directly readable from hex file (little endian) e.g., 01E2 opcode 0xE b ldi r16, 0x21 (loads value 0x21 into register r16) Martin Perner Microcontroller Basics March 6,
5 AVR Core Register Martin Perner Microcontroller Basics March 6, : C940C002F93202F015618F F082 : F2F FEF0DBF01E20EBF66 : E002B90FEF01B904E40EBB00E00FBB22 : F00E B90C941800CA : C C6C6F20576F726C6421B3 : E : FF Used to perform operations ldi r16, 0x21 (loads value 0x21 into register r16) subi r16, 0x61 (subtract 0x61 from value stored in register r16) Store the result of operations Martin Perner Microcontroller Basics March 6, General Purpose AVR 32 GP Register à 8 bit Mapped into SRAM at first 32 addresses Some operations have restrictions on the use of registers, e.g., subi only works on registers 16 R26 31 can be used as 16 Bit address pointers X, Y, Z (see addressing modes) and are also accessible via XL, XH,... Martin Perner Microcontroller Basics March 6,
6 AVR Core Status Register Martin Perner Microcontroller Basics March 6, Special register containing information about result of the last (few) instruction I Global Interrupt Enable T T-bit (can be used for bit copy) H Half Carry Flag S Sign Bit (N XOR V) V Two s Complement Overflow Flag N Negative Flag Z Zero Flag C Carry Flag Status Register Martin Perner Microcontroller Basics March 6, Affected flags can be seen in the Instruction Set Flags can be used to determine program flow Martin Perner Microcontroller Basics March 6,
7 Flag Example AVR Core Martin Perner Microcontroller Basics March 6, Control Flow Martin Perner Microcontroller Basics March 6, Branch Flags in the status register can also be used for conditional branch (jump-if-statements). Very limited range, though! BREQ label1 ; jumps to label1 if Z=1 BRLO label2 ; jumps to label2 if C=1... Unconditional Jumps JMP (reaches complete memory range) RJMP (one cycle faster but smaller range) Martin Perner Microcontroller Basics March 6,
8 AVR Core RAM Martin Perner Microcontroller Basics March 6, General Purpose Register and IO-Register mapped into SRAM address range ATmega kb SRAM Multiple addressing modes Register Direct Data Direct Data Indirect (Pointer) Powerful displacement, pre-decrement, and post-increment modes! AVR Core Martin Perner Microcontroller Basics March 6, Martin Perner Microcontroller Basics March 6,
9 IO-Modules Configured by IO-Registers Digital IO Ports: DDRx, PORTx, PINx EEPROM: EEARH/L, EEDR, EECR Ext. Interrupts: EICRA, EIMSK, EIFR Timer UART... Detailed explanations in the manual Depend on used microcontroller IO-Modules Martin Perner Microcontroller Basics March 6, Attention Opcodes in and out only work on the 64 I/O Registers, not on the External ones! PORT{H,J,K,L}, TIMSK*, ADC,... are all in the External range Using lds/sts on the 64 I/O Registers directly does not work! The assembler only complains if you try in/out with a value > 64. There are comments in m1280def.inc, if you are unsure. Alternatively, Chapter 33 Register Summary of the ATmega1280 manual also lists these registers. AVR Core Martin Perner Microcontroller Basics March 6, Martin Perner Microcontroller Basics March 6,
10 Example Program. NOLIST. INCLUDE m1280def. inc. LIST ; Name t h e r e g i s t e r s you a r e u s i n g. ;. equ temp, 0 x10 ; r16. equ x, 0 x10 ; r16 (! ). equ temp1, 0 x11 ; r17. equ temp2, 0 x12 ; r18 ;. s e c t i o n. t e x t. g l o b a l main. org 0 x0000 ; r e s e t v e c t o r jmp main Unconditional Jump Function toupper : push temp2 mov temp2, x ; backup x i n temp2 s u b i x, ' a ' ; s u b t r a c t ' a ' from x b r l o e n d o f s u b ; i f x < ' a ' do nothing ; e l s e s u b i x, ' z ' 'a ' ; s u b t r a c t ' z ' 'a ' from x b r l o e n d o f s u b ; i f x 'a ' >='z' a '+1 ; do n o t h i n g. e l s e s u b i temp2, 0x20 ; t o u p p e r backup end of sub : mov x, temp2 ; r e s t o r e x pop temp2 r e t main : l d i temp, l o 8 (RAMEND) ; i n i t i a l i z e s t a c k p o i n t e r out SPL, temp l d i temp, h i 8 (RAMEND) out SPH, temp l d i temp, 0 x00 ; s e t PORTA to z e r o out PORTA, temp l d i temp, 0xFF out DDRA, temp Register ; and Direct i n i t i a l i z e as IO-Register Direct o u t p u t l d i temp, l o 8 ( mydata ) ; i n i t i a l i z e Z to p o i n t a t data out ZL, temp l d i temp, h i 8 ( mydata ) out ZH, temp l o o p : Program Indirect lpm temp, Z+ ; r e a d data from f l a s h Post ; u s i n gincrement p o s t i n c r e m e n t c p i temp, 0 x00 breq end Conditional ; got t e r mjump i n a t i o n c a l l t o u p p e r Function ; c a l l t o ucall p p e r ( temp ) out PORTA, temp ; o u t p u t jmp l o o p end : jmp end mydata :. b y t e 'H', ' e ', ' l ', ' l ', ' o ', ' ', 'W', ' o ', ' r ', ' l ', ' d ', '! ', '\0 ' Martin Perner Microcontroller Basics March 6, Getting Code onto the Microcontroller Chip Starting with an assembler program... How do we get a running program on the microcontroller? Martin Perner Microcontroller Basics March 6, Starting with an Assembler File Assembler file not directly download-able because file is not binary includes (m1280def.inc) names of registers (temp) calculations ( z - a ) jump-labels (toupper) comments... Martin Perner Microcontroller Basics March 6,
11 Starting with an Assembler File File needs to be assembled so that... mnemonics are replaced by their opcodes includes directives are resolved register-names are translated to addresses calculations are replaced by their results jump-labels are replaced by addresses comments are removed... Martin Perner Microcontroller Basics March 6, Easy Way Makefile Use Makefile and type make and make install to assemble and download a program Problem Makefile might not be there (e.g., new toolchain or first MC exam!) Solution Get to know the toolchain and learn how to write a Makefile (Ex 2.1.2) Martin Perner Microcontroller Basics March 6, Short Makefile Primer Targets A Makefile consists of targets. A target can have dependencies (files, other targets). The target s name is a file which will be created by the target (exception: phony targets). The first target in the Makefile is the default target. Targets can have patterns, e.g., %.c matches c-files. Usually there are implicit targets shipped with Make. You can try make -n -p to see the effective Makefile used. Martin Perner Microcontroller Basics March 6,
12 Short Makefile Primer.PHONY: clean demo.elf: demo.s avr-as -mmcu=atmega1280 -o demo.o demo.s avr-ld -mavr51 -o demo.elf demo.o clean: rm -f demo.o demo.elf Note: Indentations in Makefile must be with tabulator! Spaces will not work! Martin Perner Microcontroller Basics March 6, Short Makefile Primer demo.o: demo.s avr-as -mmcu=atmega1280 -o demo.o demo.s demo.elf: demo.o avr-ld -mavr51 -o demo.elf demo.o Martin Perner Microcontroller Basics March 6, Short Makefile Primer This looks nice. But what if you have a different file name, e.g., main.s? Variables You can define variables to, e.g., allow for simple file renaming. Variables can be set in the shell environment. Using $(CC) or $(CFLAGS) may also be benefical. Make has automatic variables. They are very useful with pattern targets, e.g., $@ holds the (expanded) name of the target. Martin Perner Microcontroller Basics March 6,
13 Short Makefile Primer FILENAME MCU ARCH AS LD ASFLAGS LDFLAGS = main = atmega1280 = avr51 = avr-as = avr-ld = -mmcu=$(mcu) = -m$(arch) all: $(FILENAME).elf $(FILENAME).elf: $(FILENAME).s $(AS) $(ASFLAGS) -o $(<:.s=.o) $< $(LD) $(LDFLAGS) -o $@ $(@:.elf=.o) Martin Perner Microcontroller Basics March 6, Short Makefile Primer TARGETNAME = main.elf [...] all: $(TARGETNAME) %.o: %.s $(AS) $(ASFLAGS) -o $@ $< %.elf: %.o $(LD) $(LDFLAGS) -o $@ $< Martin Perner Microcontroller Basics March 6, Short Makefile Primer Can we get even shorter? $ make -p -f/dev/null [...] COMPILE.s = $(AS) $(ASFLAGS) $(TARGET_MACH) [...] %.o: %.s # recipe to execute (built-in): $(COMPILE.s) -o $@ $< [...] Note: this depends on the implict rules available! Martin Perner Microcontroller Basics March 6,
14 Short Makefile Primer FILENAME MCU ARCH AS LD ASFLAGS LDFLAGS = main.elf = atmega1280 = avr51 = avr-as = avr-ld = -mmcu=$(mcu) = -m$(arch) all: $(FILENAME) %.elf: %.o $(LD) $(LDFLAGS) -o $@ $< Martin Perner Microcontroller Basics March 6, Generating an Executable for a Microcontroller file1.s Assembler file1.o file2.s Assembler file2.o Linker project.elf / project.out avr-as Libraries avr-ld can be done inside avrprog2 project.elf / project.elf project.out Locator flash.hex eeprom.hex Programmer MC avr-objcopy avrprog2 Martin Perner Microcontroller Basics March 6, Generating an Executable for a Microcontroller Assembler Transforms mnemonics into opcodes (binary) Performs inline calculations Includes other files Linker Links multiple files Calculates addresses (Jumps to ISR!) Martin Perner Microcontroller Basics March 6,
15 Generating an Executable for a Microcontroller file1.s Assembler file1.o file2.s Assembler file2.o Linker project.elf / project.out avr-as Libraries avr-ld can be done inside avrprog2 project.elf / project.elf project.out Locator flash.hex eeprom.hex Programmer MC avr-objcopy avrprog2 Martin Perner Microcontroller Basics March 6, Generating an Executable for a Microcontroller project.elf Needs to be split to adhere to the physical realization of microcontroller (Flash, EEPROM, RAM).text Flash.eeprom EEPROM.data SRAM?!? RAM not directly programmable!!!!! in C initialized from Flash by init-code automatically linked into the program Done by avr-objcopy (or by the programmer) AVR - Toolchain Martin Perner Microcontroller Basics March 6, Features many other useful programs avr-objdump (disassemble object files) avr-size... These programs have various options Martin Perner Microcontroller Basics March 6,
16 Programming Typical Programming Interfaces Parallel SPI JTAG (also debugging capabilities) Bootloader (read executable from an interface) Thus, there are various programmers Programming Martin Perner Microcontroller Basics March 6, avrprog2 Used in the lab USB host interface SPI target interface UNIX command line interface (maintained by us) Not only Flash and EEPROM are programmable, but also Fuses (WARNING know what you are doing no need to change anything at the lab hardware) Lock Bits Martin Perner Microcontroller Basics March 6, Questions? Martin Perner Microcontroller Basics March 6,
EE 308: Microcontrollers
EE 308: Microcontrollers Introduction Aly El-Osery Electrical Engineering Department New Mexico Institute of Mining and Technology Socorro, New Mexico, USA January 6, 2018 Aly El-Osery (NMT) EE 308: Microcontrollers
More informationAVR ISA & AVR Programming (I) Lecturer: Sri Parameswaran Notes by: Annie Guo
AVR ISA & AVR Programming (I) Lecturer: Sri Parameswaran Notes by: Annie Guo 1 Lecture Overview AVR ISA AVR Instructions & Programming (I) Basic construct implementation 2 Atmel AVR 8-bit RISC architecture
More informationAVR ISA & AVR Programming (I)
AVR ISA & AVR Programming (I) Lecturer: Sri Parameswaran Notes by: Annie Guo Week 1 1 Lecture Overview AVR ISA AVR Instructions & Programming (I) Basic construct implementation Week 1 2 1 Atmel AVR 8-bit
More informationAVR ISA & AVR Programming (I) Lecturer: Sri Parameswaran Notes by: Annie Guo
AVR ISA & AVR Programming (I) Lecturer: Sri Parameswaran Notes by: Annie Guo 1 Lecture Overview AVR ISA AVR Instructions & Programming (I) Basic construct implementation 2 Atmel AVR 8-bit RISC architecture
More informationEE 308: Microcontrollers
EE 308: Microcontrollers Review Part I Aly El-Osery Electrical Engineering Department New Mexico Institute of Mining and Technology Socorro, New Mexico, USA February 15, 2018 Aly El-Osery (NMT) EE 308:
More informationModule 8: Atmega32 Stack & Subroutine. Stack Pointer Subroutine Call function
Module 8: Atmega32 Stack & Subroutine Stack Pointer Subroutine Call function Stack Stack o Stack is a section of RAM used by the CPU to store information temporarily (i.e. data or address). o The CPU needs
More informationEE 308: Microcontrollers
EE 308: Microcontrollers Introduction to the Assmbly Language Aly El-Osery Electrical Engineering Department New Mexico Institute of Mining and Technology Socorro, New Mexico, USA January 25, 2018 Aly
More informationMechatronics and Microcomputers. Stipendium Hungaricum 2018/2019 Autumn Semester Szilárd Aradi, PhD
Mechatronics and Microcomputers Stipendium Hungaricum 2018/2019 Autumn Semester Szilárd Aradi, PhD ATmega128 CPU Single-level pipelining Egyciklusú ALU működés Reg. reg., reg. konst. közötti műveletek
More informationEE 308: Microcontrollers
EE 308: Microcontrollers Interrupts Aly El-Osery Electrical Engineering Department New Mexico Institute of Mining and Technology Socorro, New Mexico, USA March 1, 2018 Aly El-Osery (NMT) EE 308: Microcontrollers
More informationModule 2: Introduction to AVR ATmega 32 Architecture
Module 2: Introduction to AVR ATmega 32 Architecture Definition of computer architecture processor operation CISC vs RISC von Neumann vs Harvard architecture AVR introduction AVR architecture Architecture
More informationCOMP2121: Microprocessors and Interfacing
Interfacing Lecture 9: Program Control Instructions http://www.cse.unsw.edu.au/~cs2121 Lecturer: Hui Wu Session 1, 2006 Program control instructions in AVR Stacks Overview Sample AVR assembly programs
More informationReview on Lecture-1. ICT 6641: Advanced Embedded System. Lecture 2 Branch, Call and Delay Loops, AVR I/O port programming
ICT 6641: Advanced Embedded System Lecture 2 Branch, Call and Delay Loops, AVR I/O port programming Prof. S. M. Lutful Kabir Session: April, 2011 Review on Lecture-1 Three parts of a computer : CPU, Memory
More informationAVR Microcontrollers Architecture
ก ก There are two fundamental architectures to access memory 1. Von Neumann Architecture 2. Harvard Architecture 2 1 Harvard Architecture The term originated from the Harvard Mark 1 relay-based computer,
More informationFIFTH SEMESTER DIPLOMA EXAMINATION IN ENGINEERING/ TECHNOLOGY-MARCH 2014 EMBEDDED SYSTEMS (Common for CT,CM) [Time: 3 hours] (Maximum marks : 100)
(Revision-10) FIFTH SEMESTER DIPLOMA EXAMINATION IN ENGINEERING/ TECHNOLOGY-MARCH 2014 EMBEDDED SYSTEMS (Common for CT,CM) [Time: 3 hours] (Maximum marks : 100) PART-A (Maximum marks : 10) I. Answer all
More informationCOMP2121 Introductory Experiment
COMP2121 Introductory Experiment Objectives: In this introductory experiment, you will: Learn how to use AVR studio, an Integrated Development Environment (IDE) for developing AVR applications in Windows
More informationMicrocontrollers. Microcontroller
Microcontrollers Microcontroller A microprocessor on a single integrated circuit intended to operate as an embedded system. As well as a CPU, a microcontroller typically includes small amounts of RAM and
More informationEE 308: Microcontrollers
EE 308: Microcontrollers AVR Architecture Aly El-Osery Electrical Engineering Department New Mexico Institute of Mining and Technology Socorro, New Mexico, USA January 23, 2018 Aly El-Osery (NMT) EE 308:
More informationCN310 Microprocessor Systems Design
CN310 Microprocessor Systems Design Instruction Set (AVR) Nawin Somyat Department of Electrical and Computer Engineering Thammasat University Outline Course Contents 1 Introduction 2 Simple Computer 3
More informationMicroprocessor Fundamentals. Topic 8 Binary Addition
Microprocessor Fundamentals Topic 8 Binary Addition Objectives Examine several assembler directives:.dseg /.eseg /.cseg.db.byte Use indirect addressing X register (r26 and r27) Post-increment Store results
More informationChapter 1 Microprocessor architecture ECE 3120 Dr. Mohamed Mahmoud http://iweb.tntech.edu/mmahmoud/ mmahmoud@tntech.edu Outline 1.1 Computer hardware organization 1.1.1 Number System 1.1.2 Computer hardware
More informationMicroprocessors And Microcontrollers (Practical)
Microprocessors And Microcontrollers (Practical) Semester : 4 th, 5 th (TL, ES) Course Code : ES256, ES313 By: Dr. Attiya Baqai Assistant Professor, Department of Electronics, MUET. 3 Introduction to Programming
More informationLab Objectives. 2. Preparations. 3. Signing in. 4. Examining the Host Environment. 5. Part A: Introduction to AVR Studio. 5.
Lab 0 1. Objectives Learn how to use AVR studio, an Integrated Development Environment (IDE) for developing AVR applications in Windows environments, to debug and run an AVR assembly program. Understand
More informationEmbedded Systems and Software
Embedded Systems and Software Lecture 11 Interrupts Interrupts Slide 1 Interrupts One way to think of interrupts is that they are hardwaregenerated functions calls Internal Hardware When timer rolls over,
More information8-bit Microcontroller with 8K Bytes Programmable Flash AT90C8534. Preliminary
Features Utilizes the AVR RISC Architecture AVR High-performance and Low-power RISC Architecture 118 Powerful Instructions Most Single Clock Cycle Execution 32 x 8 General-purpose Working Registers Up
More informationAVR MICROCONTROLLER ARCHITECTURTE
AVR MICROCONTROLLER ARCHITECTURTE AVR MICROCONTROLLER AVR- Advanced Virtual RISC. The founders are Alf Egil Bogen Vegard Wollan RISC AVR architecture was conceived by two students at Norwegian Institute
More informationAVR. (AVR Assembly Language) Assembler . ก ก
AVR (AVR Assembly Language). ก ก Assembler 2 1 ก /* * AVRAssembler1.asm * * Created: 9/7/2554 9:40:18 * Author: xp */.org 0 rjmp RESET ;Reset Handle rjmp RESET rjmp RESET RESET: ldi r16, 0b11111111 ;load
More informationDESIGN NOTE #032. AVR Boot Loader. Introduction. Overview AUTHOR: MARIANO BARRÓN RUIZ KEYWORDS: BOOT LOADER, SPM, SELF-PROGRAMMING
DESIGN NOTE AUTHOR: #032 MARIANO BARRÓN RUIZ ISPBARUM@SB.EHU.ES KEYWORDS: BOOT LOADER, SPM, SELF-PROGRAMMING This document is originally distributed by AVRfreaks.net, and may be distributed, reproduced,
More informationVCC PB2 (SCK/ADC1/T0/PCINT2) PB1 (MISO/AIN1/OC0B/INT0/PCINT1) PB0 (MOSI/AIN0/OC0A/PCINT0)
Features High Performance, Low Power AVR 8-Bit Microcontroller Advanced RISC Architecture 120 Powerful Instructions Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers Fully Static
More informationProgramming Microcontroller Assembly and C
Programming Microcontroller Assembly and C Course Number CLO : 2 Week : 5-7 : TTH2D3 CLO#2 Student have the knowledge to create basic programming for microcontroller [C3] Understand how to program in Assembly
More informationAVR. 2. (Assembler directives ) 3. ( Instruction field) 5. (Comment field) 1. (Label field) Assembler. 4. ก (Operands field) (AVR Assembly Language)
3 AVR (AVR Assembly Language). ก ก ก /* * AVRAssembler1.asm * * Created: 9/7/2554 9:40:18 * Author: xp */.org 0 rjmp RESET ;Reset Handle rjmp RESET rjmp RESET RESET: ldi r16, 0b11111111 ;load register
More informationELEG3924 Microprocessor
Department of Electrical Engineering University of Arkansas ELEG3924 Microprocessor Ch.2 Assembly Language Programming Dr. Jing Yang jingyang@uark.edu 1 OUTLINE Inside 8051 Introduction to assembly programming
More informationIAS0430 MICROPROCESSOR SYSTEMS
IAS0430 MICROPROCESSOR SYSTEMS Fall 2018 Arduino and assembly language Martin Jaanus U02-308 martin.jaanus@ttu.ee 620 2110, 56 91 31 93 Learning environment : http://isc.ttu.ee Materials : http://isc.ttu.ee/martin
More informationELEG3923 Microprocessor Ch.2 Assembly Language Programming
Department of Electrical Engineering University of Arkansas ELEG3923 Microprocessor Ch.2 Assembly Language Programming Dr. Jingxian Wu wuj@uark.edu OUTLINE 2 Inside 8051 Introduction to assembly programming
More informationToday s Menu. >Use the Internal Register(s) >Use the Program Memory Space >Use the Stack >Use global memory
Today s Menu Methods >Use the Internal Register(s) >Use the Program Memory Space >Use the Stack >Use global memory Look into my See examples on web-site: ParamPassing*asm and see Methods in Software and
More informationBy: Dr. Hamed Saghaei
By: Dr. Hamed Saghaei The AVR RISC Microcontroller supports powerful and efficient addressing modes for access to the program memory (Flash) and data memory (SRAM). This section describes the different
More informationAVR Subroutine Basics
1 P a g e AVR Subroutine Basics READING The AVR Microcontroller and Embedded Systems using Assembly and C) by Muhammad Ali Mazidi, Sarmad Naimi, and Sepehr Naimi Chapter 3: Branch, Call, and Time Delay
More informationCHW 469 : Embedded Systems
CHW 469 : Embedded Systems Instructor: Dr. Ahmed Shalaby http://bu.edu.eg/staff/ahmedshalaby4# I/O Ports in AVR The AVR microcontroller and embedded systems using assembly and c Topics AVR pin out The
More informationAPPENDIX A FOR SKEE3732 LABORATORY 1 SHEET
APPENDIX A FOR SKEE3732 LABORATORY 1 SHEET Other documents that are referred within this document are located at the link https://www.dropbox.com/sh/s16jri4eol3agl5/aaazn_w3p7fodjs-wi-xcenqa?dl=0 The ATmega32/ATmega2A
More informationProgramming. A. Assembly Language Programming. A.1 Machine Code. Machine Code Example: Motorola ADD
A. Assembly Language Programming Programming of a computer system: Machine code direct execution Assembly language tool: assembler High level programming language tool: interpreter tool: compiler Programming
More informationPractical Malware Analysis
Practical Malware Analysis Ch 4: A Crash Course in x86 Disassembly Revised 1-16-7 Basic Techniques Basic static analysis Looks at malware from the outside Basic dynamic analysis Only shows you how the
More informationIntroduction to Assembly language
Introduction to Assembly language 1 USING THE AVR MICROPROCESSOR Outline Introduction to Assembly Code The AVR Microprocessor Binary/Hex Numbers Breaking down an example microprocessor program AVR instructions
More informationCOMP2121: Microprocessors and Interfacing. Instruction Set Architecture (ISA)
COMP2121: Microprocessors and Interfacing Instruction Set Architecture (ISA) http://www.cse.unsw.edu.au/~cs2121 Lecturer: Hui Wu Session 2, 2017 1 Contents Memory models Registers Data types Instructions
More informationCOMP2121: Microprocessors and Interfacing. Instruction Formats and Addressing Modes
COMP2121: Microprocessors and Interfacing Instruction Formats and Addressing Modes http://www.cse.unsw.edu.au/~cs2121 Lecturer: Hui Wu Session 2, 2017 1 1 Overview Instruction format AVR instruction format
More informationMicroprocessors & Interfacing
Lecture Overview Microprocessors & Interfacing Interrupts (II) Interrupts in AVR External interrupts Internal interrupts Timers/Counters Lecturer : Dr. Annie Guo S2, 2008 COMP9032 Week7 1 S2, 2008 COMP9032
More informationInterrupts (II) Lecturer: Sri Parameswaran Notes by: Annie Guo
Interrupts (II) Lecturer: Sri Parameswaran Notes by: Annie Guo 1 External Interrupts The external interrupts are triggered by the INT7:0 pins. If enabled, the interrupts will trigger even if the INT7:0
More informationChapter 4: Atmel s AVR 8-bit Microcontroller Part 1 Assembly Programming
Chapter 4: Atmel s AVR 8-bit Microcontroller Part 1 Assembly Programming Prof. Ben Lee Oregon State University School of Electrical Engineering and Computer Science Chapter Goals Understand how to program
More informationCOMP2121: Microprocessors and Interfacing
Lecture 19: Interrupts II http://www.cse.unsw.edu.au/~cs2121 Lecturer: Hui Wu Session 1, 2006 Overview AVR Interrupts Interrupt Vector Table System Reset Watchdog Timer Timer/Counter0 Interrupt Service
More informationCSIS1120A. 10. Instruction Set & Addressing Mode. CSIS1120A 10. Instruction Set & Addressing Mode 1
CSIS1120A 10. Instruction Set & Addressing Mode CSIS1120A 10. Instruction Set & Addressing Mode 1 Elements of a Machine Instruction Operation Code specifies the operation to be performed, e.g. ADD, SUB
More informationLab 2: Basic Assembly Programming and Debugging using AVR Studio. Due: December 13, 2011
Lab 2: Basic Assembly Programming and Debugging using AVR Studio 1 Outcomes Due: December 13, 2011 Familiarize yourself with the capabilities of the ATMEGA32 embedded microcontroller and AVR Studio Develop
More informationMicrocontroller VU
136 182.694 Microcontroller VU Kyrill Winkler SS 2014 Featuring Today: Structured C Programming Weekly Training Objective Already done 3.1.1 C demo program 3.1.3 Floating point operations 3.3.2 Interrupts
More informationGates and flip-flops: glue logic, simple FSMs, registers Two-level PLDs: FSMs, muxes, decoders. Programmable logic devices (CSE370, CSE467)
Computational hardware Digital logic (CSE370) Gates and flip-flops: glue logic, simple FSMs, registers Two-level PLDs: FSMs, muxes, decoders Programmable logic devices (CSE370, CSE467) Field-programmable
More informationIntroduction to Embedded Systems and Chapter 1: Introduction to HCS12/MC9S12. EE383: Introduction to Embedded Systems University of Kentucky
Introduction to Embedded Systems and Chapter 1: Introduction to HCS12/MC9S12 EE383: Introduction to Embedded Systems University of Kentucky Samir Rawashdeh With slides based on material by H. Huang Delmar
More informationChapter 1. Microprocessor architecture ECE Dr. Mohamed Mahmoud.
Chapter 1 Microprocessor architecture ECE 3130 Dr. Mohamed Mahmoud The slides are copyright protected. It is not permissible to use them without a permission from Dr Mahmoud http://www.cae.tntech.edu/~mmahmoud/
More informationAT90S Bit Microcontroller with 1K bytes Downloadable Flash AT90S1200. Features. Description. Pin Configuration
Features Utilizes the AVR Enhanced RISC Architecture 89 Powerful Instructions - Most Single Clock Cycle Execution 1K bytes of In-System Reprogrammable Downloadable Flash - SPI Serial Interface for Program
More information8-bit Microcontroller with 2/4/8K Bytes In-System Programmable Flash. ATtiny261/V ATtiny461/V ATtiny861/V. Preliminary
Features High Performance, Low Power AVR 8-Bit Microcontroller Advanced RISC Architecture 123 Powerful Instructions Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers Fully Static
More informationET2640 Microprocessors
ET2640 Microprocessors Unit -2 Processor Programming Concepts Basic Control Instructor : Stan Kong Email : skong@itt-tech.edu Figure 2 4 Bits of the PSW Register 8051 REGISTER BANKS AND STACK 80 BYTES
More informationDepartment of Electronics and Instrumentation Engineering Question Bank
www.examquestionpaper.in Department of Electronics and Instrumentation Engineering Question Bank SUBJECT CODE / NAME: ET7102 / MICROCONTROLLER BASED SYSTEM DESIGN BRANCH : M.E. (C&I) YEAR / SEM : I / I
More informationCHAPTER 2: AVR ARCHITECTURE & ASSEMBLY LANGUAGE PROGRAMMING
CHAPTER 2: AVR ARCHITECTURE & ASSEMBLY LANGUAGE PROGRAMMING SECTION 2.1: THE GENERAL PURPOSE REGISTERS IN THE AVR 1. 8 2. 8 3. 8 4. 0xFF 5. $28 in R20 6. (a), (c), (d), (e), (g) 7. (c) 8. This is an illegal
More informationECED3204: Microprocessor Part I--Introduction
ECED3204: Microprocessor Part I--Introduction Jason J. Gu Department of 1 Outline i. Computer ii. Processor iii. Embedded System iv. Memory v. Program Execution VI. VII. VIII. IX. AVR AVR Memory AVR CPU
More informationLecture 20: AVR Programming, Continued. AVR Program Visible State (ones we care about for now)
18 100 Lecture 20: AVR Programming, Continued S 15 L20 1 James C. Hoe Dept of ECE, CMU April 2, 2015 Today s Goal: You will all be ace AVR hackers! Announcements: Midterm 2 can be picked up in lab and
More informationDevelopment Tools. 8-Bit Development Tools. Development Tools. AVR Development Tools
Development Tools AVR Development Tools This section describes some of the development tools that are available for the 8-bit AVR family. Atmel AVR Assembler Atmel AVR Simulator IAR ANSI C-Compiler, Assembler,
More informationC Language Programming, Interrupts and Timer Hardware
C Language Programming, Interrupts and Timer Hardware In this sequence of three labs, you will learn how to write simple C language programs for the MC9S12 microcontroller, and how to use interrupts and
More informationAssembly AVR Boot loader
Assembly AVR Boot loader Mariano Barrón Ruiz ispbarum@sb.ehu.es Introduction This document presents a software written in assembly for self-programming all AVR microcontrollers with Boot Loader Flash Section.
More information,$5$SSOLFDWLRQ1RWH$95 (IILFLHQWSURJUDPPLQJRI$WPHO V $95 PLFURFRQWUROOHUV
,$5$SSOLFDWLRQ1RWH$95 (IILFLHQWSURJUDPPLQJRI$WPHO V $95 PLFURFRQWUROOHUV 6XPPDU\ This application note provides some useful hints on how to program the Atmel AVR microcontrollers using the IAR Compiler.
More informationLab Course Microcontroller Programming
Technische Universität München Fakultät für Informatik Forschungs- und Lehreinheit Informatik VI Robotics and Embedded Systems Lab Course Microcontroller Programming Michael Geisinger geisinge@in.tum.de
More informationEE 5340/7340 Motorola 68HC11 Microcontroler Lecture 1. Carlos E. Davila, Electrical Engineering Dept. Southern Methodist University
EE 5340/7340 Motorola 68HC11 Microcontroler Lecture 1 Carlos E. Davila, Electrical Engineering Dept. Southern Methodist University What is Assembly Language? Assembly language is a programming language
More informationET-BASE AVR ATmega64/128
ET-BASE AVR ATmega64/128 ET-BASE AVR ATmega64/128 which is a Board Microcontroller AVR family from ATMEL uses MCU No.ATmega64 and ATmega128 64PIN. Board ET-BASE AVR ATmega64/128 uses MCU s resources on
More informationECE 375 Computer Organization and Assembly Language Programming Winter 2018 Solution Set #2
ECE 375 Computer Organization and Assembly Language Programming Winter 2018 Set #2 1- Consider the internal structure of the pseudo-cpu discussed in class augmented with a single-port register file (i.e.,
More informationก AVR Microcontrollers
ก AVR Microcontrollers. ก ก AVR Microcontrollers Architecture 1 Instruction Execution Timing The Parallel Instruction Fetches and Instruction Executions Single Cycle ALU Operation AVR Microcontrollers
More informationCOMP3221: Microprocessors and Embedded Systems
Embedded Systems Lecture 6: Addressing Modes http://www.cse.unsw.edu.au/~cs3221 Lecturer: Hui Wu Session 2, 2005 Addressing Modes Overview Instruction Examples 1 2 Operands Immediate Addressing Instructions
More informationRegister-Level Programming
Introduction Register-Level Programming Programming can be considered a set a instructions that are executed in a precise order. A programming simulator can evaluate how instructions store, move and calculate
More informationMark II Aiken Relay Calculator
Introduction to Embedded Microcomputer Systems Lecture 6.1 Mark II Aiken Relay Calculator 2.12. Tutorial 2. Arithmetic and logical operations format descriptions examples h 8-bit unsigned hexadecimal $00
More informationInstallation and Maintenance
Chapter 9 Installation and Maintenance 9.1 Hardware and software System requirements. 215 9.2 Operating Manuals. 216 9.3 Software. 221 9.4 Maintenance. 225 Chapter 9 Installation and Maintenance. This
More information8-bit Microcontroller with 2/4/8K Bytes In-System Programmable Flash. ATtiny261 ATtiny461 ATtiny861. Automotive
Features High Performance, Low Power AVR 8-Bit Microcontroller Advanced RISC Architecture 123 Powerful Instructions Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers Fully Static
More information8-bit Microcontroller with 2K Bytes of In-System Programmable Flash. ATtiny22 ATtiny22L. Preliminary. Features. Description
Features Utilizes the AVR RISC Architecture AVR - High-performance and Low-power RISC Architecture 118 Powerful Instructions - Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers
More informationMenu. >Debugging/Simulating in Atmel Studio >Downloading and Debugging/Emulating with the UF-board. Machine Codes 6811: $86 $0A GCPU: $02 $0A
Big Picture Assembler Directives Examples using: Menu >Debugging/Simulating in Atmel Studio >Downloading and Debugging/Emulating with the UF-board Look into my... See on web-site: GCPU_to_XMEGA.pdf, Examples:
More informationData Transfer Instructions
Data Transfer Instructions (Credit: Hui Wu/COMP2121 Lecture Notes) Load Direct (ld): ld Rd, v Rd {r0, r1,..., r31} and v {x, x+, -x, y, y+, -y, z, z+, -z} (remember the X, Y, Z pointers) Load Program Memory
More informationIntroduction to AVR-STUDIO
DEPARTAMENTO DE TECNOLOGÍA ELECTRÓNICA ESCUELA TÉCNICA SUPERIOR DE INGENIERÍA INFORMÁTICA Introduction to AVR-STUDIO Computer Structure 1.Introduction and goals The goals of this session are the following:
More information8051 Microcontroller
8051 Microcontroller The 8051, Motorola and PIC families are the 3 leading sellers in the microcontroller market. The 8051 microcontroller was originally developed by Intel in the late 1970 s. Today many
More informationMC9S12 Address Space
MC9S12 Address Space MC9S12 has 16 address lines MC9S12 can address 2 16 distinct locations For MC9S12, each location holds one byte (eight bits) MC9S12 can address 2 16 bytes 2 16 = 65536 2 16 = 2 6 2
More informationECE 353 Lab 4. General MIDI Explorer. Professor Daniel Holcomb Fall 2015
ECE 353 Lab 4 General MIDI Explorer Professor Daniel Holcomb Fall 2015 Where are we in Course Lab 0 Cache Simulator in C C programming, data structures Cache architecture and analysis Lab 1 Heat Flow Modeling
More informationSYLLABUS UNIT - I 8086/8088 ARCHITECTURE AND INSTRUCTION SET
1 SYLLABUS UNIT - I 8086/8088 ARCHITECTURE AND INSTRUCTION SET Intel 8086/8088 Architecture Segmented Memory, Minimum and Maximum Modes of Operation, Timing Diagram, Addressing Modes, Instruction Set,
More information8-bit Microcontroller with 2K Bytes of In-System Programmable Flash AT90S2323 AT90LS2323 AT90S2343 AT90S/LS2323. Features.
Features Utilizes the AVR RISC Architecture AVR - High-performance and Low-power RISC Architecture 118 Powerful Instructions - Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers
More informationChapter 7 Central Processor Unit (S08CPUV2)
Chapter 7 Central Processor Unit (S08CPUV2) 7.1 Introduction This section provides summary information about the registers, addressing modes, and instruction set of the CPU of the HCS08 Family. For a more
More informationOUTLINE. STM32F0 Architecture Overview STM32F0 Core Motivation for RISC and Pipelining Cortex-M0 Programming Model Toolchain and Project Structure
ARCHITECTURE AND PROGRAMMING George E Hadley, Timothy Rogers, and David G Meyer 2018, Images Property of their Respective Owners OUTLINE STM32F0 Architecture Overview STM32F0 Core Motivation for RISC and
More informationAT89S8252 Development Board V1.0. Manual
AT89S8252 Development Board V1.0 Manual Page 1 Chapter 1. Introduction 1.1 Introduction This user s guide describes how to connect to and set-up the AT89S8252 Development Board, for program development
More informationARM Cortex-M4 Architecture and Instruction Set 1: Architecture Overview
ARM Cortex-M4 Architecture and Instruction Set 1: Architecture Overview M J Brockway January 25, 2016 UM10562 All information provided in this document is subject to legal disclaimers. NXP B.V. 2014. All
More informationDiploma in Embedded Systems
Diploma in Embedded Systems Duration: 5 Months[5 days a week,3 hours a day, Total 300 hours] Module 1: 8051 Microcontroller in Assemble Language Characteristics of Embedded System Overview of 8051 Family
More informationC Language Programming, Interrupts and Timer Hardware
C Language Programming, Interrupts and Timer Hardware In this sequence of three labs, you will learn how to write simple C language programs for the MC9S12 microcontroller, and how to use interrupts and
More informationORG ; TWO. Assembly Language Programming
Dec 2 Hex 2 Bin 00000010 ORG ; TWO Assembly Language Programming OBJECTIVES this chapter enables the student to: Explain the difference between Assembly language instructions and pseudo-instructions. Identify
More informationCOMP2121 Experiment 4
COMP2121 Experiment 4 1. Objectives In this lab, you will learn AVR programming on Parallel input/output; Some typical input/output devices; and Interrupts 2. Preparation Before coming to the laboratory,
More informationAddressing Modes Part II AVR Addressing Indirect READING
1 P a g e Addressing Modes Part II AVR Addressing Indirect READING The AVR Microcontroller and Embedded Systems using Assembly and C) by Muhammad Ali Mazidi, Sarmad Naimi, and Sepehr Naimi Chapter 6: AVR
More informationProgram Development Tools
Program Development Tools GNU make (much of this material is adapted from GNU Make by Richard Stallman) The make utility automatically determines which pieces of a large program need to be recompiled,
More informationENE 334 Microprocessors
Page 1 ENE 334 Microprocessors Lecture 9: MCS-51: Moving Data : Dejwoot KHAWPARISUTH http://webstaff.kmutt.ac.th/~dejwoot.kha/ ENE 334 MCS-51 Moving Data Page 2 Moving Data: Objectives Use commands that
More information8051 Instruction Opcodes In Hexadecimal Order
8051 Instruction Opcodes In Hexadecimal Order x86 opcode cheatsheet Opcode 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 8051 Microcontroller Instruction Set Table 1-4. Instruction Opcodes
More informationEE 308: Microcontrollers
EE 308: Microcontrollers Timers Aly El-Osery Electrical Engineering Department New Mexico Institute of Mining and Technology Socorro, New Mexico, USA April 2, 2018 Aly El-Osery (NMT) EE 308: Microcontrollers
More informationCOSC 243. Instruction Sets And Addressing Modes. Lecture 7&8 Instruction Sets and Addressing Modes. COSC 243 (Computer Architecture)
COSC 243 Instruction Sets And Addressing Modes 1 Overview This Lecture Source Chapters 12 & 13 (10 th editition) Textbook uses x86 and ARM (we use 6502) Next 2 Lectures Assembly language programming 2
More informationCPE 323 MSP430 INSTRUCTION SET ARCHITECTURE (ISA)
CPE 323 MSP430 INSTRUCTION SET ARCHITECTURE (ISA) Aleksandar Milenković Email: milenka@uah.edu Web: http://www.ece.uah.edu/~milenka Objective Introduce MSP430 Instruction Set Architecture (Class of ISA,
More informationCOMP3221: Microprocessors and. and Embedded Systems. Instruction Set Architecture (ISA) What makes an ISA? #1: Memory Models. What makes an ISA?
COMP3221: Microprocessors and Embedded Systems Lecture 2: Instruction Set Architecture (ISA) http://www.cse.unsw.edu.au/~cs3221 Lecturer: Hui Wu Session 2, 2005 Instruction Set Architecture (ISA) ISA is
More informationBefore next weeks lab:
Before next weeks lab: - To sign in to lab computers use student and Phys319. - read the lab manual for week two. - look at the tools installation guide for OS of your choice and/or lab computer guide,
More information