Microcontroller Programing
Microcontroller Programing
MICROCONTROLLER
PROGRAMMING
Hardware/Software interface
Layers of the Machine
Kinds of Software
Computer Languages
Syntax, Semantics, Grammars
01 What happens to your program?
Compilation, Linking, Execution
INTRODUCTION TO Program errors
System SW
Programs written for computer systems
Compilers, operating systems, …
Application SW
Programs written for computer users
Word-processors, spreadsheets, & other application
packages
A Layered View of the Computer
Application Programs
Word-Processors, Spreadsheets,
Database Software, IDEs,
etc…
System Software
Compilers, Interpreters,Preprocessors, etc.
Operating System, Device Drivers
– Machine Language
• Uses binary code
• Machine-dependent
• Not portable
Assembly Language
• Uses mnemonics
• Machine-dependent
• Not usually portable
..
Computer Languages
Compiler
• A program that converts another program from some
source language (or high-level programming language / HLL)
to machine language (object code).
• Some compilers output assembly language which is then
converted to machine language by a separate assembler.
• Is distinguished from an assembler by the fact that each
input statement, in general, correspond to more than one
machine instruction.
Compilation into Assembly L
Source Assembly
Program Compiler Language
Assembly Machine
Assembler
Language Language
Compilers & Programs
Source program
• The form in which a computer program, written in some
formal programming language, is written by the
programmer.
• Can be compiled automatically into object code or machine
code or executed by an interpreter.
• Pascal source programs have extension ‘.pas’
Compilers & Programs
Object program
• Output from the compiler
• Equivalent machine language translation of the source
program
• Files usually have the extension ‘.obj’
Executable program
• Output from linker/loader
• Machine language program linked with necessary libraries
& other files
• Files usually have the extension ‘.exe’
What is a Linker?
Computed results
Program Output
Program Execution
Source
Program
Interpreter Output
Input
Compilation:
• Syntax errors caught before running the program
• Better performance
• Decisions made once, at compile time
Interpretation:
• Better diagnostics (error messages)
• More flexibility
Compilation vs. Interpretation
Intermediate
Program
VM Output
Input
Java Compiler
bytecode
ML Interpreter