Programming the PIC Microcontroller with MBasic

Now that we've learned how to read analog voltages, to store data in an external EEPROM, to read digital temperature sensors and to write an interactive serial program, let's assemble these disparate concepts into a data logging mini-weather station.
We'll measure temperature, relative humidity and barometric pressure and save the data to external EEPROM for later extraction. In order to keep the program to manageable length, we'll not implement the full interactive serial functions, but what you've learned in Chapter 9 will let you add it, should you so desire. And, of course, you might decide to add an LCD display and additional temperature sensors and have a selfcontained indoor/outdoor weather station.
We've limited our weather station sensor suite to the three commonest elements: relative humidity, barometric pressure and temperature. For each element, we have a wide selection of sensor types, but to keep things simple, we'll limit our sensor selection to integrated modules. We'll first review our choice of sensors, next see how they connect to the PIC and finally write the code to make it work.
As we learned in introductory science classes, air is a mixture of gases including, most importantly oxygen and nitrogen, but also water vapor. Relative humidity is defined as the ratio of actual vapor pressure of water to the saturation vapor pressure, i.e., the maximum amount of water vapor the air can hold before it precipitates out as liquid water droplets or mist. Relative humidity is customarily expressed as a...