Consultancy and Total Solutions Training Provider for Embedded Systems, Electronics and Electrical Engineering, Programming, Computing, Operations, ISO9000, ISO14000 and Management.

Bridging the Gap

Training Courses

Developing Reliable Embedded Systems with C

Course id: 0006


The C programming language is used in the majority of embedded applications. It is however, generally not considered a suitable language for systems where reliability and safety is paramount; due to its anomalies, undefined behaviour, weak data typing and weak runtime checking. Many programmers nevertheless opt to code in C due to familiarity, flexibility, efficiency, code density and widely available libraries.

The reliability of embedded systems programmed in C can be greatly enhanced by adhering to specific coding styles and constructs, such as the checking of array indices, automatic termination of runaway loops and majority voting of inputs.

This course introduces methodologies to increase system reliability via a combination of programming styles, software and hardware error detection and/or correction techniques.

Course highlight
Participants would be introduced to programming styles, the MISRA guidelines and error detection and/or correction techniques to increase the tolerance of embedded systems to external influences, programming errors and hardware faults.

The course interlaces lectures with hands-on practicals using MPLAB tools for maximum effectiveness.

What participants say about the course
The following are some verbatim statements from the participants:

  • Exploration on MISRA guidelines and firmware documentation software -- Feb 2011
  • Real experience sharing and knowledge from instructor related to this course -- Apr 2012
  • Instructor is willing to share, helpful and knowledgeable. The content is interesting -- Apr 2012
  • Good examples & detailed exercises -- Apr 2012
  • Several coding techniques that are not typically used -- Jun 2012

What you will learn

This course concentrates on the theoretical and practical knowledge to allow participants to achieve the following learning outcomes. Upon completing the course, participants would be able to:
  • Use the MISRA C guidelines for safe and reliable coding
  • Understand and mitigate the caveats and pitfalls of undefined C behaviour
  • Implement active error detection methods for pointers, arrays, structures and program flow
  • Modularise programs using a layered framework to ease debugging and promote reusability
  • Eliminate/reduce the impact of environmental instabilities and unknowns to the system

Who should attend

This course is particularly suited for design engineers, application engineers, software engineers and programmer responsible for designing, implementing and verifying embedded systems.


Participants should be reasonably fluent with the C language. Participants lacking C programming experience are highly recommended to attend the "Practical C Programming for Engineers" course before hand.

Participants should also be reasonably adept in the design of digital electronic systems.

Course methodology

This course is presented in a workshop style with lectures interlaced with demonstrations and practicals for maximum understanding.

Course duration

4 days.

Course structure

The first two days concentrates on the coding style and the C programming language itself. Day three concentrates on the peripheral aspect of embedded systems while day four concentrates on the hardware.

Day 1

  • Introduction: why C? why not C? MISRA guidelines
  • Coding Style: comments, indentation, blocks, documentation
  • Practical 1: Visual Improvements and Documentation
  • Operators and Data Types: arithmetic, increment and decrement, relational, logical, bitwise, type widths, implicit type conversion, loss of precision, conversion, loss of sign, typecasting
  • Practical 2: Operators and Data Types
  • Variables and Constants: scope, naming conventions, accessing critical variables/constants, checksumming critical variables/constants
  • Practical 3: Robust Variables – range check, majority voting
  • Flow Control: if-else, loops, termination
  • Practical 4: Loop Termination
Day 2
  • Pointers: declaration, accessing, termination, type conversion
  • Practical 5: Robust Pointers
  • Arrays: declaration, accessing, runtime boundary checking
  • Practical 6: Robust Arrays
  • Characters and Strings: declaration, accessing
  • Structures and Unions: declaration, accessing, runtime boundary checking, bitwise access
  • Functions: declaration, call, return, parameters, recursion, C standard library functions
  • Practical 7: proper character, string and function declaration, parameter checking, printf alternatives
Day 3
  • Preprocessor Directives: proper usage of #include, #define
  • Modularisation: linking modules, layered framework
  • Practical 8: Modularisation
  • Interrupt Handling: polling methodology, coding interrupt service routines, handling level triggered interrupts
  • Practical 9: Interrupt Handling
  • Time Triggered Framework: schedulers, timer-based framework, SEOS, SEOS with timeout, loop timeout
  • Practical 10: Simple Embedded Operating System
  • Non-Blocking Tasks: STD, FSM, Non-blocking FSM
  • Practical 11: Domotic Controller
Day 4
  • Robust Program Flow: Function Tokens, NOP Fills
  • Practical 12: Function Tokens and NOP Fills
  • Watchdog Timer: using, disadvantages
  • Off-chip Communication: polling for data, incomplete packetized data, timeouts
  • Practical 13: Buffering and Packetisation
  • Robust I/O: contact bounce, port voting, range rejection, input averaging, shadow port, port refreshing
  • Practical 14: Robust I/O
  • Debugging: Blinking LED, print debugging, in-circuit debugging


Dr Royan Ong

Course Schedule





News on ProvenPac

  ProvenPac Sdn. Bhd.
  C-4-3 Gembira Park,
  Jalan Riang, 58200
  Kuala Lumpur, Malaysia

  Tel: +603 03 5889 5889

No public course
currently scheduled.


Please inform me when
this course is scheduled.


Please contact me to
arrange in-house training.