Crs 245 Advanced C Programming for Microcontrollers
The course is for experienced C programmers, working on embedded systems,
who would like to learn structured programming techniques, fill in gaps in
their knowledge, and learn about more advanced data structures and algorithms.
It will also cover object oriented programming techniques as implemented
in C, useful in projects where a UML design is to be realised in C and
assembler.
Coverage of the MISRA programming guidelines for developing safety critical code are included,
and the tools available for checking conformance to these guidelines are reviewed
Extensions to ANSI C that are provided by various compilers targeted
at micro-controller based systems - such as pragmas, keywords for
specifying a function as an interrupt handler, keywords for specifying
special function registers, and addressable bits are critically discussed.
Code profiling, tuning and optimisation techniques are discussed, including
discussion of situations where it might be better to implement modules in assembler
that can be accessed via C function calls.
A considerable part of the course is devoted to detailed coverage of
interrupt handling, multi-tasking via polled, interrupt driven and hybrid approaches,
timer driven multi-tasking scheduler implementation,
control of access to critical resources, memory and buffer management,and the
implementation of device driver software. |
Course Outline
C syntax - intensive overview
- Base data types, operators, functions, if .. else, switch, for loops, while
and do - while loops
- structures, arrays of structures and pointers to structures
- function pointers
- C Macro pre-processor
Finite State Machines (FSMs)
- Event driven systems
- FSM diagrams
- Switch statement implementation of an FSM
- Table driven implementation of an FSM
- Push Down Automata
- Extending FSMs via Statecharts
- Implementing Statechart designs in C
Modular code - Components and Object Oriented Coding in C
Principles of Object Oriented thinking
Software components and interfaces
Singly and doubly linked lists
Queues - Stacks (LIFOs), Buffers (FIFOs)
Relationships and Indexes
- Representing relationships and associations in C
- One to one, one to many and many to many relationships
- Binary trees
- Balanced binary trees (AVL Trees, Red-Black trees)
- Hufmann encoding
- Heaps
- Priority Queues
- Hash tables
- Cyclic redundancy checksums
I/O, Interrupts,Timers and Device Drivers
- Working with micro-controller I/O ports
- On chip peripherals and alternate I/O port functions
- How interrupts are implemented on different architectures
- Timers and timer interrupts
- Capture/Compare timer functions
- UARTs and USARTs
- I2C and SPI
- A/D converters, sampling, data smoothing
- Pulse Width Modulation (PWM)
- Reset functions
- Watchdog timers
- Display devices - LCDs, 7 segment LEDs, Graphics display devices
- Keypad and keyboard input
- mixed C and assembly language programming
Multitasking Paradigms
Polled loop
State driven polled loop
Interrupt driven
Hybrid interrupt and polled driven systems
Timer interrupt driven co-operative multi-tasking
Master-slave multi-processor systems
Simple RTOS implementations
|
Intended Audience
The course is aimed at experienced programmers, who have a good understanding
of embedded systems hardware. It is designed for programmers and engineers
who will be embarking on advanced projects involving many 1000's of lines of code.
The course covers both hardware and software aspects of developing embedded
systems applications, and assumes a reasonable degree of understanding of the
hardware and electronics aspects of developing embedded systems applications.
This is a tough and challenging course and is not suitable for "casual programmers".
To get the most benefit from this course you must love and enjoy solving
challenging problems of a programming nature and like working "close to the
hardware". |