EOS
 Instruments
 Barometer Sensor
 Programming Exercise in PicAxe
 The output of the Philip Harris Barometer Sensor is directly proportional to the barometric pressure of the surrounding air.  The sensor is inside the Blue Box.  The Blue Box output voltage ranges from 0 to +1.0 V, corresponding to a barometric pressure from 950 millibar to 1050 millibar.    Note on units of pressure The System-International (SI, commonly known as the MKS system) unit of pressure is the pascal (Pa), which is the same as Newton/meter2.   To get an idea of how much pressure is one pascal: an apple has the weight of about one newton, so if the weight is spread over one square meter (about a square yard) it is not much pressure indeed.   One-hundred thousand pascal  (105 Pa) is a unit of pressure defined as the bar, so one millibar (mB) is 100 pascal – a reasonable pressure scale.   The pressure of the atmosphere varies, of course, but it averages roughly 1000 millibar, so the range of the Blue Box is put squarely around atmospheric pressure.   Another common unit of pressure is the inch of mercury (inHg).  Atmospheric pressure will produce a height difference in a mercury manometer over a range of about 28 to 30 inches.  More precisely, the conversion is 1 bar = 29.529 inHg.  Notice that the low end of the Blue Box scale is 950 mB = 28.053 inHg.  Useful conversions:                           1mB = .029529 inHg                           1 inHg = 33.86 mB
 The Assignment   Write a program to read the analog input of the PicAxe microprocessor 08M2 at the pin C.1, convert that to barometric pressure, continuously update and display the result on the OLED.  The OLED display must include the word “Barometric” centered on the first line and the second line must display – centered – the current value of barometric pressure with units.    Also, the barometric pressure display must periodically alternate between the two units “milliBar” and “inch Hg”.  Set the timing to an aesthetically pleasing value, about 10 seconds perhaps.
 The simplest solution is to write a Flowchart in Logicator first, then convert the Flowchart into Basic language.  Inevitably, the Flowchart will not be complete so a modification of the program will be necessary.   Use Programming Editor 6 to complete the program.  The Flowchart might look something like this:
 Basic commands which might be useful for the solution First, define some variables such as these: symbol variablename = pinC.2                         ‘ no space between “pin” and “C.2” symbol  Vinput = w0 symbol  Pressure = w1                          ‘w0 and w1 are word variables, i.e., 16 bit variables.   Commands related to reading the analog input:              fvrsetup FVR2048              adcconfig %011              readadc10 C.2   Commands related to displaying the output:              bintoascii              serout C.1, N2400_4,(254, 128,”                “)               serout C.1, N2400_4,(254, 192, “   “,b9,b10,b11,”          “)                           Note that whatever is within the parenthesis is displayed on the OLED.                           Make sure that there are exactly 16 characters or spaces within parenthesis.                           128 is the leftmost position on line 1 of the OLED                           192 is the leftmost position of line 2 of the OLED                           bintoascii converts a binary number to a display character.   Commands related to logic and math:              if   variablename = 0     then . . .                           endif              goto (linename)              VariableA = VariableB * 2 + 800 / 7   ‘math protocol strictly left to right;  integers   only
 Power Supply on PicAxe Circuit Board Power Input:                +7.0 V to +35.0V; connector is center positive; nominally +9.0V dc power adaptor is used (+9.0 V battery for portable use, but avoid if possible since current drain is high - battery won’t last long). Power Output:            +5.0 V, regulated                                        200mA maximum current                                        Red LED “on” indicator. This power supply is hardwired to both the PicAxe and the OLED display; red lead positive/black lead ground, 0V.
 Axe 133Y Serial OLED         16x2 yellow on black OLED display Power requirements:    +5.0 V Axe133Y OLED input, ”IN”, is connected to PicAxe pin C.1 –  green wire. Note that PicAxe pin C.1 can be used as a serial output to the OLED with the “serout” command.               NOTE:                          AXE133Y requires firmware for its AXE18M2 chip; it is already downloaded.  If necessary, however, the firmware can be found at http://www.picaxe.com/downloads/axe133y.bas.txt  (Be sure the line   #define use_OLED   is “uncommented”.)
 08M2 Microprocessor                                                                             http://www.picaxe.com/ Power:                                        +5.0 V Input voltage limits:     0 to +5.0 V Input leads:                    Red banana plug, C.1                                        Black banana plug, ground, 0V In / Out Table:             NOTE:             The red banana plug is hardwired to microprocessor input pin C.2 Notice from the diagram that pin C.2 can be used as an ADC (analog-to-digital) input. NOTE:  The numbers 1-8 refer to the “actual legs”, not pin numbers.  For example, pin C.5 is actual leg number 2.
 Philip Harris Barometer Sensor                    Blue Box Use only the red and black banana jack connectors on the Blue Box.  Never use the blue banana jack.   Power requirements:    +6.0 V; separate external battery pack                                        Battery pack red lead positive/Black lead ground, 0V Output (red/black banana jacks):              Output ranges from 0 Volts to +1 Volt, and is linear in barometric pressure sensed by the probe.               Red jack, voltage out; Black jack, ground, 0V.              Switch in “BATT” position:              The Blue Box output will be +1.0 V if the battery voltage is +6.0 V.   Replace batteries if this output is below +0.75 V (corresponding to a battery voltage of +4.5 V). NOTE: Do not use blue banana jack – negative voltage on the PicaAxe input may damage the microprocessor.
 Blue Box Manual
 Solution