Chapter 11. Instrumentation Data I/O
It is a capital mistake to theorize before one has data.
In Chapter 7 we looked at the various physical interfaces and signal protocols that you might encounter with instrumentation systems. Now we’ll look at how to use those interfaces to move data between the real world and our applications.
The data an instrumentation system collects or generates comes in a variety of formats and fulfills a wide range of needs. We’ll start this chapter with a discussion of interface formats and protocols, defining the basic concepts we will need for the upcoming software examples. Then we’ll take a quick tour of some packages that are available for interface support in Python: namely, the pySerial, pyParallel, and PyVISA packages.
Lastly, I’ll show you some techniques to read and write instrumentation data. We’ll take a look at blocking versus nonblocking I/O, asynchronous input and output events, and how to manage potential data I/O errors to help make your applications more robust.
Data I/O Interface Software
Over the years, computer interface hardware has evolved from simple devices using serial communications and I/O registers mapped into a computer’s memory address space to complex subsystems with their own built-in processors, onboard logic, advanced protocols, and complex API definitions. As the complexity grew, the number of unique interface methods and protocols also began to grow. As you might imagine, if a large system had to support ...
Get Real World Instrumentation with Python now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.