View difference between Paste ID: Cad17gmr and 7XwDtLW5
SHOW: | | - or go back to the newest paste.
1-
OBJ
1+
CON 
2
  _clkmode = xtal1 + pll16x 
3-
  pst   : "parallax serial terminal"
3+
  _xinfreq = 5_000_000 
4-
  alt   : "29124_altimeter"
4+
  
5
  XB_Rx     = 0    ' XBee DOUT 
6-
CON
6+
  XB_Tx     = 1    ' XBee DIN 
7
  XB_Baud   = 9600 
8-
  _clkmode      = xtal1 + pll16x  
8+
  CR        = 13   ' Carriage Return value       
9-
  _xinfreq      = 5_000_000       
9+
10
  START_ALT = 1317 ' Your starting altitude in feet.                                                                   
11-
  START_ALT     = 1317             ' Your starting altitude in feet. You can get this from a local airport
11+
OBJ 
12
   XB    : "FullDuplexSerial"
13-
PUB start | a, p, t
13+
   alt   : "29124_altimeter"  
14
Pub  Start | a, p, t  
15-
  pst.start(38400)                                       ' Start Parallax serial terminal.
15+
XB.start(XB_Rx, XB_Tx, 0, XB_Baud) ' Initialize comms for XBee 
16
   
17
waitcnt(clkfreq + cnt)
18-
  alt.set_altitude(alt.m_from_ft(START_ALT * 100))       ' Set the starting altitude, based on average local pressure.                  
18+
19
  alt.start(alt#QUICKSTART, alt#BACKGROUND)              ' Start altimeter for QuickStart with background processing.
20
  alt.set_resolution(alt#HIGHEST)                        ' Set to highest resolution.
21-
    pst.str(string(pst#HM, "Altitude:"))                 ' Print header.   HM = home
21+
  alt.set_altitude(alt.m_from_ft(START_ALT * 100))       ' Set the starting altitude, based on average local pressure.
22-
    pst.str(alt.formatn(a, alt#METERS | alt#CECR, 8))    ' Print altitude in meters, clear-to-end, and CR.
22+
                 
23-
    pst.str(alt.formatn(a, alt#TO_FEET | alt#CECR, 18))  ' Print altitude in feet, clear-to-end, and CR.
23+
24
    a := alt.altitude(alt.average_press)                 ' Get the current altitude in cm, from new average local pressure.
25
    XB.str(string("Altitude:"))                 
26-
    pst.str(string("Barometric Pressure:"))
26+
    XB.str(alt.formatn(a, alt#METERS, 8))    ' Print altitude in meters
27-
    pst.str(alt.formatn(p, alt#MILLIBARS | alt#CECR, 8))
27+
    XB.tx(13)
28-
    pst.str(alt.formatn(p, alt#TO_INCHES | alt#CECR, 27))
28+
    XB.str(alt.formatn(a, alt#TO_FEET, 18))  ' Print altitude in feet, clear-to-end, and CR. \
29
    XB.tx(13)
30
    
31-
    pst.str(string("Temperature:"))
31+
32-
    pst.str(alt.formatn(t, alt#DEGC | alt#CECR, 8))
32+
    XB.str(string("Barometric Pressure:"))
33-
    pst.str(alt.formatn(t, alt#TO_DEGF | alt#CECR, 20))
33+
    XB.str(alt.formatn(p, alt#MILLIBARS, 8))
34
    XB.tx(13)
35-
    if (pst.rxcount)                                     ' Respond to any key by clearing screen.
35+
    XB.str(alt.formatn(p, alt#TO_INCHES, 18))
36-
      pst.rxflush
36+
    XB.tx(13)
37-
      pst.char(pst#CS)
37+
38
    t := alt.current_temp
39
    XB.str(string("Temperature:"))
40
    XB.str(alt.formatn(t, alt#DEGC, 8))
41
    XB.tx(13)
42
    XB.str(alt.formatn(t, alt#TO_DEGF, 18))
43
    XB.tx(13)
44
    XB.tx(13)