Shop OBEX P1 Docs P2 Docs Learn Events
RCTime — Parallax Forums

RCTime

NewzedNewzed Posts: 2,503
edited 2006-05-19 15:44 in Propeller 1
Jon wrote a program for RCTime which I downloaded from the Parallax site.· He·writes in part:

PUB start(pin, state, rcvalueaddress) : okay···

I understand that pin would be replaced by 0, 1,2, etc., and that state would be replaced by 1 or 0.· What is "rcvalueaddress"?· Is this an EEPROM location that would hold the value of the RC time?· How do I read it?· Suppose I wanted to send the value to Hyperterminal using the Tx line - how would I do that?

Sid

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-05-19 13:48
    rcvalueaddress is the address of the variable that you want updated.· When you use the start method of this object, the rctime method is moved into its own cog and will continously update the variable -- that method needs to know where (in RAM) the variable is located.

    Use the @ (address of) operator to pass the address of a variable:

    · rc.start(0, 1, @potVal)

    This assumes you've declared an object of rctime called rc, and that you've declared a variable (a long) called potVal.

    My June column in Nuts & Volts covers the updated version of the rctime object and how to use it.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • NewzedNewzed Posts: 2,503
    edited 2006-05-19 14:37
    Thanks a lot, Jon.· I thought it might be something like that.· OK, now I have a variable called potval.· Would I be able to display this value on Hyperterminal using TV Terminal/Terminal Demo?

    I am having a very difficult time grasping SPIN - guess I'm getting to old to absorb new stuff easily.· I'll probably have to be hand-fed every step of the way.

    Sid
  • Paul BakerPaul Baker Posts: 6,351
    edited 2006-05-19 15:00
    For display on Hyperterminal you'd use fullduplex.spin to send serial data to the PC.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    1+1=10
  • NewzedNewzed Posts: 2,503
    edited 2006-05-19 15:26
    Paul, there are many PUB options in that program.· If I wrote

    PUB str(potvalue)

    Would it automatically display potvalue in Hyper?



    How would I write it if I wanted to display:

    Pin 0 - 1234 - Pass

    I am really quite brain-dead when it come to SPIN.

    Sid
  • NewzedNewzed Posts: 2,503
    edited 2006-05-19 15:38
    In other words, could I select a PUB option just by entering valid paramaters in the parantheses, i.e.,

    PUB tx("Q")

    or

    PUB dec(5)

    Sid
  • Paul BakerPaul Baker Posts: 6,351
    edited 2006-05-19 15:44
    No, that would send the binary value contained in potvalue, you would need to send the ASCII equivalent of the binary value, you could probably import the dec or hex methods used in various other objects. This is the same as with stamps, you have to specify the format you want the value converted to in SEROUT so it will appear at the terminal in the desired format, otherwise it will just send the binary value, which would likely be an unprintable charactor displayed in hyperterminal.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    1+1=10
Sign In or Register to comment.