Programming Embedded Systems
Frank Vahid | Tony Givargis | Bailey Miller
zyBooks 2017

Table of Contents

1. Introduction to Embedded Systems
1.1 What is an embedded system?
1.2 Basic components
1.3 RIMS
1.4 Timing diagrams
1.5 Testing

2. Embedded programming
2.1 C in embedded systems
2.2 C data types
2.3 RIMS implicitly defined I/O variables
2.4 Hexadecimal
2.5 Bitwise operators
2.6 Shift operators
2.7 Bit access functions
2.8 Rounding and overflow

3. State Machines
3.1 Time-ordered behavior
3.2 State machines
3.3 RIBS
3.4 Implementing an SM in C
3.5 Variables, statements, and conditions in SMs
3.6 Mealy actions
3.7 How to capture behavior as an SM
3.8 Testing an SM
3.9 Capture/convert process

4. Synchronous SMs
4.1 Time-interval behavior
4.2 Synchronous SMs
4.3 SynchSMs and time intervals for inputs
4.4 Choosing a period for different time intervals
4.5 Microcontrollers with timers
4.6 Converting a synchSM to C
4.7 State actions should never wait

5. Concurrent synchSMs
5.1 Concurrent synchSMs
5.2 Shared variables
5.3 Converting multiple synchSMs to C
5.4 Converting synchSM local variables to C
5.5 Keeping distinct behaviors distinct
5.6 Task communication
5.7 Queues

6. Input/Output
6.1 Sampling of inputs
6.2 Latency
6.3 Input conditioning
6.4 Avoiding output glitching
6.5 I/O electrical issues
6.6 Dealing with too few pins

7. Peripherals
7.1 Pulse width modulation
7.2 UARTs
7.3 Analog-digital conversion

8. Task Scheduler
8.1 Converting different-period tasks to C
8.2 Creating a task structure in C
8.3 Code for a simple cooperative task scheduler

9. Programming Issues
9.1 C functions versus lookup tables
9.2 Fixed-point programming
9.3 Lookup tables again

10. Utilization/Scheduling
10.1 Timer overrun
10.2 Utilization
10.3 Computing a task’s worst-case execution time
10.4 Utilization for multiple tasks
10.5 Jitter
10.6 Scheduling
10.7 Preemptive scheduler
10.8 Triggered synchSMs
10.9 Reducing power consumption using a sleep function
10.10 Disciplined programming

11. Control Systems
11.1 Introduction to control systems
11.2 Proportional control
11.3 Proportional-derivative (PD) control
11.4 Proportional-integral-derivative (PID) control
11.5 PID tuning

12. Digital Signal Processing
12.1 Introduction to digital signal processing
12.2 Sensors
12.3 Actuators
12.4 ADC and amplification
12.5 Bias correction
12.6 Sample rate and quantization
12.7 Aliasing
12.8 Low pass filter
12.9 Playback path
12.10 Digital-to-analog converter
12.11 A DSP example
12.12 Digital processing

13. FPGA
13.1 Introduction to synchSMs on FPGAs
13.2 Translating a synchSM to VHDL
13.3 Achieving the proper synchSM tick rate
13.4 Multiple synchSMs

14. Pattern Recognition
14.1 Framework introduction
14.2 Part 1: Feature extraction
14.3 Part 2: Pattern recognition
14.4 Part 3: Actuation