Preface xvi

How this book came to be written xvi

Highlights of this book xvi

Is this book for you? xviii

WARNINGS! xix


Chapter 1 Introduction 1

Microcontrollers 1

Programming Languages 2


Chapter 2 Efficiency & Planning 5

Efficient Design With a Microcontroller 5

Plan, Plan, Plan, Plan, and Then Do 7

System Integration 11


Chapter 3 C: Variables and Operators 13

Programming languages 13

Variables 17

8051 Memory spaces 20

Operators 21


Chapter 4 C: Branching & Looping 28

Branching Constructs 29

Looping Constructs 32

Click to see sample page (15K PDF)


Chapter 5 C: Functions 38

Five Kinds of Functions 38

Function Examples 40

Advanced Function Topics 44


Chapter 6 C: Arrays & Pointers 48

Arrays 48

Structures 50

Memory Spaces 52

Pointers 52

Unions 55


Chapter 7 IDE: Program Development 57


Chapter 8 IDE: Modular Programming 67

Why Modular? 67

C Language Modules 68

Assembly Language Modules 70

Scope of Variables and Functions 71

Mixing Module Languages 72

Libraries 77

Code Efficiency 77


Chapter 9 Hardware: Basics & Assembly Language 79

Microcomputers 80

Computer Instructions 80

8051 Instruction Summary 92

Clock Cycles & Software Delays 100

Click to see sample page (15K PDF)


Chapter 10 Hardware: Memory, Ports & Expansion 103

Memory Technologies 103

8051 Memory 105

Parallel Ports 107

Bus expansion 108

Stand-alone Microcontrollers 110


Chapter 11 Hardware: Interrupts & Timers 112

Interrupts 112

Counters 115

Timers 116


Chapter 12 RTOS: Multitasking 124

RTOS Basics 127

Commercial RTOS 131


Chapter 13 RTOS: Scheduler 132


Chapter 14 RTOS: Real-Time Kernel Small 138

Including RTKS in Projects 146

Small RTOS compared 151


Chapter 15 RTOS: Big Kernel 153

RTKB—Priority-Based Pre-emptive Kernel 153

Commercial operating Systems 168

Cost & Benefits of RTOS 170


Chapter 16 Algorithms: User Input/Output 173

Numbers and Notations 173

Number Conversion 175

Conversion to ASCII (for a Display) 176

Decimal to Binary (input from a keypad) 178

Parsing 179

Random numbers 180


Chapter 17 Algorithms: Scaling & Tables 183

Scaling 183

Look-up Tables 185

Linear interpolation 189

Floating Point Variables 191


Chapter 18 Algorithms: Time 192

Measuring Frequency or Period 192

Maintaining a Calendar 198

Click to see sample page (15K PDF)


Chapter 19 Algorithms: Miscellaneous 201

Library Functions 201

Self-calibration of Sensors 202

Digital Signal Processing 203

Smoothing & Averaging 205

Control Algorithms 205

Fuzzy Logic 209

Adaptive Control (Self-tuning) 210

Tracking & Hill Climbing 211

Dynamic Memory Allocation 211


Chapter 20 Networks: Serial Communication 213

UART Fundamentals 213

UART Examples 215

Software-only "UARTs" 220

Serial Driver Hardware 225

EIA/TIA-232 (RS-232) Specification 226

Other Serial Protocols 229

Click here to see two sample pages (26K PDF)


Chapter 21 Algorithms: Buffers 232

Single-use Buffers 232

Cyclic (FIFO/Ring) Buffers 233


Chapter 22 Networks: Ring Topology 239

Topologies 239

Common Network Issues 240


Chapter 23 Networks: Bus Topology 250

Shared Line Communication 250

RS-422, RS-485 251

Waking Nodes—9th Bit Mode 262


Chapter 24 Networks: SPI Bus 264

8051 UART Shift Register Mode 264

SPI Bus 265


Chapter 25 Networks: I2C / SMB 269

Networking Protocols Are Similar 269

I2C/ACCESS/SMB History & Overview 269

SMB/I2C Protocol 271

Electrical Details 281


Chapter 26 Networks: CAN Bus 286

CAN Message Frame 287

CAN & the OSI Model 288

Collision/Arbitration/Priority 289

Signals 290

CAN Error Handling 291

Chip support 292

Example: CAN Message Exchange 294


Chapter 27 Networks: USB 298

All things to all people? 298

USB Architecture 300

USB Logical Abstractions 301

USB Electrical Features 302

Protocol Overview 305

Doing USB Applications 314


Chapter 28 Hardware: Digital Input 316

Interfacing TTL 316

Inputs to TTL 316

Switches & Buttons 317

Keypads 318

Keyboards 321

Music Keyboards 323

Signals From IR Remotes 323


Chapter 29 Hardware: Digital Output 326

Light-Emitting Diodes 326

Liquid Crystal Displays 329

Other Types of Alphanumeric Displays 334

CRT (Video) Drivers 334

DC Motors 334

Relays and Solenoids 336

Stepper Motors 337

Click to see two sample pages (24K PDF)


Chapter 30 Hardware: Position Input 341

Knobs & Sliders 341

Proximity & Ranging Inputs 341

Relative X-Y Position Devices 343

Absolute X-Y Position: Digitizers 345

Optical Interruptors 346

Angle Sensing 346

Optical Isolation 348


Chapter 31 Hardware: Analog Input 349

A-D Conversion 349

Analog Comparators 355

Voltage to Frequency 356

Electrical Measurements 357

Physical measurements 359

Light Inputs 361

Magnetic Inputs 363

Measuring & Recognizing Sounds 364

Speech Recognition 366

Inputs from the Physically-disabled 367


Chapter 32 Hardware: Analog Output 369

Resistor-Ladder D-A 369

Other D-A Techniques 372

Music Outputs 374

Speech Synthesis 376


Chapter 33 Hardware: Power Interfacing 377

AC Measurements 377

AC Power Production & Control 382


Chapter 34 Lists: 8051 Family Members 385


Chapter 35 Lists: Assembly Instructions 389

Alphabetic-ordered List: 389

Numeric-ordered List 396