COMPE 375
Embedded Systems Programming

Catalog Description       

Embedded system architecture and technology.  Programming IO devices and IO controllers (e.g., LEDs, switches, LCD displays, keypads, keyboards, speakers, parallel ports, serial ports, timers, analog to digital converters). Electronic considerations: RC delay and drive capability; logic levels and noise margins.  Interrupts and real-time programming.  Program development and debugging tools.  C language and assembler language.

Credits: 3 units (2 hours lecture, 3 hours lab)

Class Schedule: Two 50-minute lectures; two 80-minute lab sessions.

Prerequisite by topic:  Fundamentals of C language; fundamentals of assembler language; computer organization and operation; digital circuit fundamentals.

Prerequisite by course: CompE271

Course Objectives          

  • Be able to connect IO devices to an embedded computer or mocrocontroller and develop programs to control the resulting system.
  • Achieve a deeper understanding of the C language and assembler language, and the relationships between them.

Topics Covered  

1.  Embedded System Industry

  • History of embedded systems
  • Applications (consumer electronics, toys, ...).
  • Major technologies: fixed-processor;  soft-core (ASIC; FPGA); microcontrollers
  • Variety of IO devices (measurement devices, motors, displays, ADC, DAC,...)
  • Variety of processors (68xx, 80xx, PIC, 80x86, 68x00, ARM, Power PC...)
  • Variety of Realtime Operating Systems (RTOS, QNX, PSOS, WindowsCE, uC/OS)
  • Many vendors (no industry leaders like Microsoft in PCs)
  • Software development characteristics (cross platform, device programming, interrupt programming, realtime constraints)
  • Dominant languages: C; C++; assembler

2.   Embedded System Architecture

  • P-M-IOD-IOC model
  • Processor registers
  • Memory organization
  • Processor bus: Read and Write cycles
  • Cross-platform development: host and target
  • Downloading to target RAM, flash memory or EPROM
  • Debugging techniques: breakpoints, single-step, accessing variables, accessing processor registers, ...

3.   Absolute assembler programming

  • Processor instruction set
  • Processor address modes
  • Memory allocation (directives ORG, DC, DS)
  • Binary arithmetic
  • overflow
  • CCR bits: Z, V, N, C
  • Conditional branch instructions
  • Subroutines
  • Stack variables and reentrant subroutines

4.   Programming in C

  • Local and global variables
  • Stack frame and function call implementation
  • Bit manipulation operations:  >>, <<,  &, |, ^
  • Keyword typedef
  • Keywords struct and union
  • Using variables to access IO registers
  • Inline assembler
  • Keyword volatile
  • Memory allocation using the parameter file

5.  Programming IO Controllers and Devices

  • IO control registers
  • switches and buttons
  • eliminating key bounce
  • electronic considerations: pullup/pulldown resistors; drive capability; RC delays
  • electronic considerations: logic levels; noise margins
  • matrix keypads
  • LEDs
  • DC motors
  • Pulse-width modulators
  • Speakers
  • Photocells
  • Parallel ports (GPIO)
  • Serial ports and asynchronous communication
  • Timers
  • Analog to digital converters

6.  Interrupt Programming

  • Hardware interrupt response
  • Interrupt Service Routines
  • Simple interrupt control  (no nesting of interrupts; no RTOS)
  • Interrupt-based applications (e.g., toy piano and multitrack recorder)

Textbook

Reference documents for the CSMB-12C128 module and the MCU Project Board (available online at www.freescale.com and www.axman.com )       

References                      

  • Free online tutorials, application notes etc. on Freescale site
  • H. Huang, "The HCS12/9S12: An Introduction to Software and Hardware Interfacing", Thomson Delmar Learning, 2006
  • Barrett and Pack, "Embedded Systems: Design and Applications with the 68HC12 and HCS12", Prentice-Hall, 2004

Lab Resources 

23-station lab, with an embedded system and complete development tools at each station.  The lab is used for individual instruction and for demonstration of assigned work.  Students also purchase their own embedded systems for use at home.

Prepared by: Dr. Leonard R. Marino
Date of Preparation: 01/30/2009