Unable to locate "Parallax serial terminal"
captainruss
Posts: 2
in Propeller 1
Below is my program and error message. This program fails to compile. I've tried everthing I know but I'm stuck. It's one of things that, I'm sure, it's some very basic mistake on my part that I keep overlooking. Help, please!
CON
_xinfreq = 5_000_000 ' specify 5 MHz xtal
_clkmode = xtal1 + PLL16X ' and set clock to 80 MHz
MILLISECOND = 80_000 ' define one millisecond
MICROSECOND = 80 ' define one microsecond
PING_TRIGGER_TIME = 50 * MICROSECOND
LOOP_INTERVAL = 250 * MILLISECOND
' I/O pin assignments
PING_PIN = 7
RED_PIN = 0 ' Red LED lamp
AMBER_PIN = 1 ' Amber LED lamp
GREEN_PIN = 2 ' Green LED Lamp
BAUD = 115200
CONVERT_TO_CM = 4936
CONVERT_TO_INCH = 12537
ACTIVE_CONVERSION = CONVERT_TO_INCH
CON '' Distance Constants
'' Change these constants to set ranges.
TOO_CLOSE_THRESHOLD = 20 ' inches red flashing led
CLOSE_ENOUGH_THRESHOLD = 25 ' inches red led
APPROACHING_THRESHOLD_2 = 36 ' inches amber led '
APPROACHING_THRESHOLD = 60 ' inches green led
OBJ
pst:"Parallax Serial Terminal"
VAR
long duration
long loopstart
long distance ' distance to object, centimeters
PUB Main
pst.Start(BAUD)
dira[RED_PIN] := 1
dira[AMBER_PIN] := 1
dira[GREEN_PIN] := 1
repeat
pst.Str(string(11, 13, "About to trigger Ping."))
loopstart := cnt ' begin timed loop
dira[PING_PIN] := 1 ' ping a short pulse
outa[PING_PIN] := 1
waitcnt(PING_TRIGGER_TIME + cnt)
dira[PING_PIN] := 0 ' switch to input to sense echo
waitpne(0, |< PING_PIN, 0) ' Wait for pin to go high.
duration := -cnt ' begin duration measurement
waitpeq(0, |< PING_PIN, 0) ' Wait for pin to go low; this more accurate than the ina loop.
duration += cnt ' echo delay in sys counts
distance := duration / ACTIVE_CONVERSION ' distance in inches ( 6.17 msec/meter )
pst.Str(string(11, 13, "distance = "))
pst.Dec(distance)
if distance < TOO_CLOSE_THRESHOLD ' red flashes
!outa[RED_PIN]
outa[GREEN_PIN] := 0
outa[AMBER_PIN] := 0
pst.Str(string(11, 13, "Too close!"))
pst.Str(string(11, 13, "Less than "))
pst.Dec(TOO_CLOSE_THRESHOLD)
pst.Str(@unitsName)
elseif distance < CLOSE_ENOUGH_THRESHOLD
outa[RED_PIN] := 1
outa[GREEN_PIN] := 0
outa[AMBER_PIN] := 0
pst.Str(string(11, 13, "Good distance!"))
pst.Str(string(11, 13, "Less than "))
pst.Dec(CLOSE_ENOUGH_THRESHOLD)
pst.Str(@unitsName)
elseif distance < APPROACHING_THRESHOLD_2
outa[GREEN_PIN] := 0
outa[RED_PIN] := 0
outa[AMBER_PIN] := 1
pst.Str(string(11, 13, "Getting close but not there yet."))
pst.Str(string(11, 13, "Less than "))
pst.Dec(APPROACHING_THRESHOLD_2)
pst.Str(@unitsName)
elseif distance < APPROACHING_THRESHOLD
outa[GREEN_PIN] := 1
outa[RED_PIN] := 0
outa[AMBER_PIN] := 0
pst.Str(string(11, 13, "Getting close but not there yet."))
pst.Str(string(11, 13, "Less than "))
pst.Dec(APPROACHING_THRESHOLD)
pst.Str(@unitsName)
else
outa[RED_PIN] := 0
outa[AMBER_PIN] := 0
outa[GREEN_PIN] := 0
pst.Str(string(11, 13, "Too far away."))
pst.Str(string(11, 13, "You are at least "))
pst.Dec(APPROACHING_THRESHOLD)
pst.Str(@unitsName)
pst.Str(string(" away."))
waitcnt(LOOP_INTERVAL + loopstart)
My error message...
DAT
unitsName byte " in", 0
'unitsName byte " cm", 0
rights reserved
Compiled for i386 Win32 at 08:17:48 on 2009/07/20
Loading Object Untitled
Untitled(26,5) Error : Unable to locate object
pst:"Parallax Serial Terminal"
____^
Compiled 89 L
CON
_xinfreq = 5_000_000 ' specify 5 MHz xtal
_clkmode = xtal1 + PLL16X ' and set clock to 80 MHz
MILLISECOND = 80_000 ' define one millisecond
MICROSECOND = 80 ' define one microsecond
PING_TRIGGER_TIME = 50 * MICROSECOND
LOOP_INTERVAL = 250 * MILLISECOND
' I/O pin assignments
PING_PIN = 7
RED_PIN = 0 ' Red LED lamp
AMBER_PIN = 1 ' Amber LED lamp
GREEN_PIN = 2 ' Green LED Lamp
BAUD = 115200
CONVERT_TO_CM = 4936
CONVERT_TO_INCH = 12537
ACTIVE_CONVERSION = CONVERT_TO_INCH
CON '' Distance Constants
'' Change these constants to set ranges.
TOO_CLOSE_THRESHOLD = 20 ' inches red flashing led
CLOSE_ENOUGH_THRESHOLD = 25 ' inches red led
APPROACHING_THRESHOLD_2 = 36 ' inches amber led '
APPROACHING_THRESHOLD = 60 ' inches green led
OBJ
pst:"Parallax Serial Terminal"
VAR
long duration
long loopstart
long distance ' distance to object, centimeters
PUB Main
pst.Start(BAUD)
dira[RED_PIN] := 1
dira[AMBER_PIN] := 1
dira[GREEN_PIN] := 1
repeat
pst.Str(string(11, 13, "About to trigger Ping."))
loopstart := cnt ' begin timed loop
dira[PING_PIN] := 1 ' ping a short pulse
outa[PING_PIN] := 1
waitcnt(PING_TRIGGER_TIME + cnt)
dira[PING_PIN] := 0 ' switch to input to sense echo
waitpne(0, |< PING_PIN, 0) ' Wait for pin to go high.
duration := -cnt ' begin duration measurement
waitpeq(0, |< PING_PIN, 0) ' Wait for pin to go low; this more accurate than the ina loop.
duration += cnt ' echo delay in sys counts
distance := duration / ACTIVE_CONVERSION ' distance in inches ( 6.17 msec/meter )
pst.Str(string(11, 13, "distance = "))
pst.Dec(distance)
if distance < TOO_CLOSE_THRESHOLD ' red flashes
!outa[RED_PIN]
outa[GREEN_PIN] := 0
outa[AMBER_PIN] := 0
pst.Str(string(11, 13, "Too close!"))
pst.Str(string(11, 13, "Less than "))
pst.Dec(TOO_CLOSE_THRESHOLD)
pst.Str(@unitsName)
elseif distance < CLOSE_ENOUGH_THRESHOLD
outa[RED_PIN] := 1
outa[GREEN_PIN] := 0
outa[AMBER_PIN] := 0
pst.Str(string(11, 13, "Good distance!"))
pst.Str(string(11, 13, "Less than "))
pst.Dec(CLOSE_ENOUGH_THRESHOLD)
pst.Str(@unitsName)
elseif distance < APPROACHING_THRESHOLD_2
outa[GREEN_PIN] := 0
outa[RED_PIN] := 0
outa[AMBER_PIN] := 1
pst.Str(string(11, 13, "Getting close but not there yet."))
pst.Str(string(11, 13, "Less than "))
pst.Dec(APPROACHING_THRESHOLD_2)
pst.Str(@unitsName)
elseif distance < APPROACHING_THRESHOLD
outa[GREEN_PIN] := 1
outa[RED_PIN] := 0
outa[AMBER_PIN] := 0
pst.Str(string(11, 13, "Getting close but not there yet."))
pst.Str(string(11, 13, "Less than "))
pst.Dec(APPROACHING_THRESHOLD)
pst.Str(@unitsName)
else
outa[RED_PIN] := 0
outa[AMBER_PIN] := 0
outa[GREEN_PIN] := 0
pst.Str(string(11, 13, "Too far away."))
pst.Str(string(11, 13, "You are at least "))
pst.Dec(APPROACHING_THRESHOLD)
pst.Str(@unitsName)
pst.Str(string(" away."))
waitcnt(LOOP_INTERVAL + loopstart)
My error message...
DAT
unitsName byte " in", 0
'unitsName byte " cm", 0
rights reserved
Compiled for i386 Win32 at 08:17:48 on 2009/07/20
Loading Object Untitled
Untitled(26,5) Error : Unable to locate object
pst:"Parallax Serial Terminal"
____^
Compiled 89 L
Comments
I've attached a copy if that makes things easier for you.
https://github.com/parallaxinc/propeller/tree/master/libraries/community/p1/All/Parallax Serial Terminal
Oddly, its "Parallax" serial terminal, but is in the community folder.
Why isn't it here: https://github.com/parallaxinc/propeller/tree/master/libraries/official/p1
Nothing is in the official OBEX GITHUB, which is odd?
Just a bit ahead of the curve. PST is always available in my setup. My comments regard the program erroring out due to the if/else construct. which you will likely get after the program finds the pst object. At least thats what happened when I compiled it.
edited after seeing pst error noted in OP original post. With PST present, error out with "expected instruction or variable" before first elseif. corrected with indentation.