Shop OBEX P1 Docs P2 Docs Learn Events
Confusion! — Parallax Forums

Confusion!

Am trying to get a program running from the book "programming and customizing the multicore propeller micro."
The program is on page 140 " Test Sample RCTIME.spin ".
Here be code.
'' Test Simple RCTIME.spin
CON
_clkfreq = xtal1 + pll16x
_xinfreq = 5_000_000
OBJ
rc : "RCTime"
pst : "Parallax Serial Terminal"
PUB Go | tDecay
pst.Start(115200)
repeat
waitcnt(clkfreq/10 + cnt)
rc.time(18, 1, @tDecay)
pst.Str(String(pst#CE, pst#HM, "tDecay = "))
pst.Dec(tDecay)

When I run the program I get a " Expected a subroutine name?"
Then it highlights " rc.time(18, 1, @tDecay) "
I tried to fix it but me not so smart!!!! Thank you for any help that anyone can give. 13 feb 2019(wen).

Comments

  • Please post your code inside [ code ] [ /code] blocks (without the spaces), in order to preserve the indentation.

    Thanks,
    -Phil
  • Iguanaman,

    I don't where my copy of the book is but try using the files from here.
    ftp://ftp.propeller-chip.com/PCMProp/Chapter_04/Source/

    RC Time.spin
    Test Simple RCTIME.spin
  • RCTime can be found in the Propeller library directory. In PUB Go you only called PST Start. RCTime starts in another cog so you also have to call the start method for RCTime.
  • ErNaErNa Posts: 1,752
    '' Test Simple RCTIME.spin
    CON
    _clkfreq = xtal1 + pll16x
    _xinfreq = 5_000_000
    OBJ
    rc : "RCTime"
    pst : "Parallax Serial Terminal"
    PUB Go | tDecay
    pst.Start(115200)
    repeat
    waitcnt(clkfreq/10 + cnt)
    rc.time(18, 1, @tDecay)
    pst.Str(String(pst#CE, pst#HM, "tDecay = "))
    pst.Dec(tDecay)
    

    in this code there is no indentation to see. And in this case: repeat just runs forever as an empty loop.
    So please post your code again using the code tag.
    (Mark the code area and click the C button in the top area of this editor

  • Change rc.time(18, 1, @tDecay) to rc.rctime(18,1,@tDelay).

    @lardom, the RCTIME method may be run as either foreground or background.
  • I ran the code and found two mistakes:
    CON
    _clkmode = xtal1 + pll16x      'correct
    _xinfreq = 5_000_000
    {CON
    _clkfreq = xtal1 + pll16x         'error
    _xinfreq = 5_000_000}
    
    OBJ
    rc : "RCTime"
    pst : "Parallax Serial Terminal"
    PUB Go | tDecay
    pst.Start(115200)
    repeat
      waitcnt(clkfreq/10 + cnt)
      'rc.time(18, 1, @tDecay)             'error
      rc.RCTIME(18, 1, @tDecay)         'correct
      pst.Str(String(pst#CE, pst#HM, "tDecay = "))
      pst.Dec(tDecay)
    
    1) In the CON block, replace "_clkfreq" with "_clkmode".
    2) In the instruction "rc.time(18, 1, @tDecay)" there is no method named "time" in the RCTIME object.
Sign In or Register to comment.