Shop OBEX P1 Docs P2 Docs Learn Events
Unable to locate "Parallax serial terminal" — Parallax Forums

Unable to locate "Parallax serial terminal"

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

Comments

  • It's usually in the "library" folder under the install location. On my PC it's here: C:\Program Files (x86)\Parallax Inc\Propeller Tool v1.3.2\Library

    I've attached a copy if that makes things easier for you.
  • Clock LoopClock Loop Posts: 2,069
    edited 2020-08-31 17:46
    Its also on the NEW NEW NEW OBEX GITHUB.

    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?
  • frank freedmanfrank freedman Posts: 1,983
    edited 2020-08-31 19:57
    Check your indentation (use spaces) for the if /ifelse/else. It just compiled with no errors with indentation (as I could see it) corrected. Also, when posting code, use the code tag. The C letter in the message menu. Makes it easier to see what your actually have. Click the C in the menu and paste your code in between the tags. Check in the Prop Ed manual or propeller manual for info on indentation. It has bit me and others more than a few times.

    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.
    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)
       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)
    
    DAT
    
    unitsName byte " in", 0
    'unitsName byte " cm", 0
    
  • Ok I fixed your program at it works. I prefer propeller tool, over propeller IDE. You will have to save this program in your propeller IDE library along with the Parallax Serial Terminal.
  • One of the problems with propeller IDE is that many of the library objects were renamed differently than they are in the prop tool. So compiling programs from OBEX, which were typically written using prop tool library objects, won't work without translation.

Sign In or Register to comment.