Interfacing with C, 2nd Edition

Book description

Interfacing with C is about interfacing personal computers using C. Anyone who is interested in ports, transducer interfacing, analog to digital conversion, convolution, filters or digital/analog conversion will benefit from reading Interfacing with C. Students will also find this a practical introduction to real-time programming with a generous collection of tried and tested programs.

The pace of the book is such that the reader is encouraged to run the programs and experiment with C. The principles precede the applications in most cases in an attempt to provide genuine understanding and encourage further development. Readers will gain much from the hands-on experience the authors' approach provides, an approach designed to enable readers to climb steep learning curves with the minimum amount of assistance.

The many programs included in the text provide the essential hands-on experience. Some of the programs inevitably become rather lengthy, so the source code used is available as a free download from the Newnes website. The aim of the book, however, is to give the reader enough confidence to rewrite and improve these programs.

In the second edition Mike James has thoroughly updated all aspects relating to software, operating systems and graphical interfaces. He has also increased the scope of the book to include current forms of C++. Material on data acquisition has been thoroughly updated and the section on peripherals increased.
  • A practical and painless way of becoming an expert C programmer
  • New edition also covers C++ and the Windows environment
  • Get up to speed with the essential maths needed for C without having to buy a university maths text!

Table of contents

  1. Cover image
  2. Title page
  3. Table of Contents
  4. Copyright
  5. Preface
  6. Preface to second edition
  7. Chapter 1: An introduction to C
    1. Properties and background
    2. Fundamental interfacing
    3. Programmable input–output devices
    4. 8255 programmable peripheral interface
    5. Programming the 8255
    6. IBM PC bus
    7. Accessing specific memory locations with C
    8. Reading the contents of I/O space using pointers
    9. C program development
    10. Variables
    11. Data type
    12. Qualifiers
    13. Reading the status of an input port
    14. Controlling printf()
    15. The coercion operator: cast
    16. Writing from keyboard to output port
    17. Entering data using scanf()
  8. Chapter 2: Loops and data conversion
    1. Repetition: unconditional jumps
    2. Named constants #define
    3. Infamous goto
    4. For-loops in greater detail – in a binary counter
    5. Port monitoring with a do-while construction
    6. Light chaser effect
    7. Communicating with peripherals
    8. Successive approximation
    9. Flash conversion
    10. Dual and quad slope conversion
    11. Synchronization and software control
    12. 12-bit A-to-D conversion
    13. IBM-PC AD574A interface
  9. Chapter 3: Data acquisition using C
    1. Data capture using CGA graphics
    2. Controlling the coordinate
    3. Data capture with EGA graphics
    4. Background and foreground colour
    5. Building a Windows Application
    6. Transducer interfacing with C/C++
    7. Conditioning the signal voltage
    8. Simplifying program development
    9. Displaying temperature using EGA graphics
    10. Introducing random noise
    11. A linear transducer
    12. Measurement of light intensity
    13. Statement of the problem
  10. Chapter 4: Essential mathematics
    1. How many snapshots?
    2. Mathematical modelling
    3. Laplace transforms
    4. Electronic calculus
    5. Modelling A-to-D conversion
    6. Zero-order sample-and-hold
    7. z-notation – the algebra of sampled data systems
  11. Chapter 5: Convolution
    1. Matching analogue signals and systems
    2. Frequency-shifting rule
    3. Convolution
    4. Graphical interpretation of the convolution integral
    5. Obtaining the digital output recursively
    6. Digital feedback
    7. Obtaining the digital output by convolution
    8. Reconciling time-domain and frequency-domain processes
    9. Computerized convolution
    10. System response testing
    11. Applying the program
    12. Sophisticated applications
  12. Chapter 6: Digital filters
    1. Peripheral hardware requirements
    2. Conversion of sinusoidal signals
    3. Analogue and digital filters
    4. Recursive software
    5. Poles and zeros
    6. Band-pass digital filters
    7. Real-time band-pass filter
    8. The bilinear transform
    9. Reverberation
  13. Chapter 7: Fourier transforms
    1. Fourier transforms using a PC
    2. Discrete Fourier transform DFT
    3. Developing and explaining the program
    4. Graphical spectral analysis
    5. Understanding the logical system of coordinates
    6. Applying the DFT program
    7. Streamlining the arithmetic using the fast Fourier transform
    8. How many multiplications?
    9. FFT with real-time data capture and graphics
    10. Control of the peripheral board and data capture
    11. Signal truncation and spectral leakage
    12. Reducing spectral spreading with a Hanning window
  14. Chapter 8: Correlation
    1. Correlation methods using a PC
    2. Linear systems and random inputs
    3. Wiener–Khintchine theorem
    4. Autocorrelation
    5. Effect of finite observation time
    6. Calculating discrete autocorrelation functions
    7. Computing the autocorrelation function
    8. Anatomy of the program
    9. Graphical autocorrelation
    10. Applying the program
    11. ACF of sampled sine wave
    12. ACF of decaying exponential
    13. White noise
    14. Generating random noise and computing the ACF
    15. Anatomy of the program
    16. Using autocorrelation to detect noise-corrupted signals
    17. ACF with real-time data capture and graphics
    18. Autocorrelation in the real world
    19. The cross-correlation function
    20. System testing and characterization using random noise
    21. Order out of chaos
  15. Chapter 9: Kalman filters
    1. Kalman filters – predicting uncertainty
    2. Characterizing stochastic noise – Noddies’ guide to statistics
    3. Tracking a time-varying signal in the presence of noise – optimal estimation
    4. Applied optimal control
    5. Real-time Kalman filter
    6. Simplifying the design – the steady-state Kalman filter
    7. Appendices
  16. Chapter 10: Data conversion
    1. Digital-to-analogue conversion
    2. A primitive digitally controlled potentiometer
    3. Buffering a binary-weighted resistor network
    4. R-2R ladder network
    5. Analog devices AD7226 D-to-A converter
    6. Waveform generation using a D-to-A and C
    7. Generating sine waves – real-time and playback digital synthesis
    8. Waveform synthesis
    9. Software-based random-noise generator
    10. Digital transfer functions and waveform modification
    11. Generating echo and reverberation
    12. Historical records and circular buffers
    13. Anti-aliasing filters and filtering the D-to-A output
    14. Quantization noise
    15. Simulating audio reverberation
    16. Special audio effects
  17. Chapter 11: Investigating the spectral and time-domain performance of z-transforms using computer-managed instruction
    1. Characterizing the frequency-selective properties of the rational function
    2. A description of the frequency-selective properties of zeros
    3. Programs listed in Appendix 2
  18. Chapter 12: Introduction to digital signal processing
    1. Analog Devices
    2. Motorola
    3. Texas Instruments
    4. Software
    5. Fixed point arithmetic
    6. Application specific
  19. Chapter 13: Standard programming structures
    1. Introduction
    2. Modular design
    3. The internal structure of modules
    4. Standard programming structures
    5. Eight different ways to convert temperature in Celsius to Fahrenheit using C-based code
    6. The sequence construct
    7. Using the pre-processor directive
    8. The repetition construct
    9. Branching and looping
    10. Writing functions in C
    11. Commentary
    12. Using purpose-built I/O functions – Peeking and Poking
    13. Using the functions peek() and peekb()
    14. Using the functions poke() and pokeb()
    15. Port-mapped data transfer
    16. Input circuit
    17. Output circuit
    18. Computer part of the problem
    19. Microsoft C I/O calls
    20. Turbo C I/O calls
  20. Appendix 1
  21. Appendix 2: Listings of programs described in Chapter 11
  22. Glossary
  23. Index

Product information

  • Title: Interfacing with C, 2nd Edition
  • Author(s): Howard Hutchings, Mike James
  • Release date: December 2000
  • Publisher(s): Newnes
  • ISBN: 9780080574356