Introduction to Assembly Language Programming — A 5 day course
Synopsis
This course discusses basic 8-bit and 16-bit microcontroller architectures and their instruction sets.
You'll learn assembly language programming techniques using variables, arrays and data structures, together with the basic structured programming techniques of sequence, choice and iteration and how they can be realised in assembly language.
Objectives
- 8 bit and 16 bit micro-controller architectures and instruction sets
- Basic assembly programming techniques using variables, arrays and data structures
- The fundamental structured programming constructs of sequence, choice and iteration, and how they can be realised in assembly language code
- Structured programming techniques using flowcharts and pseudo-code and how to convert these into clear well documented assembler
- Techniques for programming of timers, peripherals and interrupt handling
- The hands on exercises also cover the use of simulation, debugging and in-circuit debugging techniques as well as techniques for in-system programming
Contents
Microprocessor Architectures
- Microprocessors compared to micro-controllers
- Uses of small micro-controllers
- Harvard and Von-Neuman architectures compared
- Memory types found in micro-controllers
- Limitations of micro-controllers
- Overview of common small micro-processor architectures
Instruction Sets and Assembly Language Programming
- Anatomy of an instruction
- Types of instruction
- How an assembler converts assembly code into machine code (object code)
- Formats for saving object code in files
- Loading code into a micro-controller
- Features found in typical Integrated Development Environments (IDEs)
- How simulators and debuggers work
- In circuit debugging and in circuit emulation compared and contrasted
Registers and Peripherals
- Special Function Registers, Working Registers, General Purpose Registers
- Typical on chip peripherals - USARTS, A/D, Timers, I/O Ports
- Basic Input / Output ( I/O )
Basic Assembly Language Program Patterns and Templates
- Implementing if-then-else logic in assembler
- Implementing iteration loops in assembler
- Calling and returning from functions in assembler
- Understanding the concept of a stack
- Hardware stacks and software stacks
- Passing arguments to functions
- Returning results from functions
- Saving and restoring context when working with functions
- Dealing with segmented memory architectures
Interrupts and Interrupt Handling
- What is an interrupt
- Enabling and disabling interrupts
- Interrupt vectors
- Prioritising of interrupts
- Nesting of interrupts
- Masking of interrupts
- Saving and restoring context in interrupt handlers
- Polling vs. interrupt driven event handling
Basic Input Output Techniques
- Displaying patterns using LEDs
- Cycling through a sequence of patterns
- Using software delays
- Using polling for timer counter overflow to implement a delay
- Using timer interrupts to implement a delay
- Using lookup tables to specify a sequence of patterns
- Driving 7/8 segment LED displays
- Buttons and keypads
- Detecting button presses using polling / interrupt approaches
- Interfacing to a 3 x 4 or 4 x 4 keypads
More Advanced Input Output Techniques
- Driving a simple two line LCD display controller
- Implementing RS232 communications using an on chip USART
- Implementing RS232 communications using "bit banging"
Tables, Arrays and Records
- Defining and implementing simple constant data lookup tables
- Defining and working with simple arrays
- Designing and implementing basic record oriented data structures
- Maths
- Binary, octal, decimal and hexadecimal numbers
- Using 1's complement and 2's complement to represent negative numbers
- How maths libraries implement basic integer arithmetic functions
- Fixed point and floating point arithmetic
- Converting a binary number into a string of digit characters
- Implementing parity checking
Prerequisites
Basic knowledge of programming and computers.
No prior knowledge of microcontrollers or assembly language is assumed.