Shop OBEX P1 Docs P2 Docs Learn Events
Help with simple serial obex/30 — Parallax Forums

Help with simple serial obex/30

stargazer2050stargazer2050 Posts: 89
edited 2012-11-10 09:27 in Propeller 1
2 propeller quickstarts
Obex 30
Want to pass a single digit variable one way

Do i load the obex30 on both boards as is?
Where do you assign the pin numbers ?
Where to put the variable or data to transfer?
What to expect and where to look for resultant transfer
How to capture the variable on the other side?

Comments

  • stargazer2050stargazer2050 Posts: 89
    edited 2012-11-10 07:38
    I can see what i type on the monitor

    How do i capture that in a variable on the other machine?


    When i load prop comm which sets tx rx.pins, i have a page of clicking and symbols.
  • stargazer2050stargazer2050 Posts: 89
    edited 2012-11-10 07:54
    2propellerquickstarts
    Prop comm
    Trying to send a variable from one to the other

    Is that what this software is for?
    Recommend another?
  • Mike GreenMike Green Posts: 23,101
    edited 2012-11-10 08:09
    You've not supplied enough information. What sort of variable do you want to send? What range of values? How fast? How often? Will you be wanting to send other values later? Will you be wanting to send back and forth? What about possible errors? How do you want to handle them?

    You could use anything from Simple_Serial to Extended FullDuplexSerial and others depending on your needs.
  • max72max72 Posts: 1,155
    edited 2012-11-10 08:14
    Try to post some more details of what you are trying to achieve, and your code so far.
    Please avoid double posts, it only upsets people.

    Usually with he objects there also is a demo, it is a nice starting point.
    In general the serial objects allow you to set the rx and tx pins, inverted/noninverted (if the idle signal is high or low), and baud rate.
    It is not clear what you are trying to do.. try to post some more details.
    Massimo
  • Mike GreenMike Green Posts: 23,101
    edited 2012-11-10 08:21
    These two threads have been merged here.
  • stargazer2050stargazer2050 Posts: 89
    edited 2012-11-10 08:36
    Hi,

    Would like to send one byte from board #1 to board #2 and save the same "variable". No need to verify ( for now)
    Im sending slowly, once in a minute or so

    I'm doing it now with pin to pin and counting the pulses but timing errors are hard to supress.
  • max72max72 Posts: 1,155
    edited 2012-11-10 08:59
    Go step by step.
    A possible path:
    Try to start with a single board and the serial terminal.
    Have the propeller sending chars to the terminal, in an endless loop.
    Then send a char from the terminal, and have the board answering you back, either the same char or the char with a change, just to have the basic setup working.
    If you get strange chars back there probably is a baud rate setting issue.
    After that increase the complexity.
    You can also format a string with the data inside. You can find a lot of examples regarding GPS data. GPS is sending strings, that are parsed by the propeller.
    Consider using a different serial object Simple serial is very basic. In the propeller install dir there is the full duplex serial, which is better.
    In the object comments you can find a lot of informations.

    Massimo
  • Mike GreenMike Green Posts: 23,101
    edited 2012-11-10 09:00
    How about using Simple_Serial? You can run the receive routine in its own cog so it's always looking at the receive line and won't miss an incoming byte value, but you don't have to if you don't mind missing an occasional value or having your main program wait until the next byte values comes in.

    On the transmit side (if you declared serial as the object), you'd just call serial.init(-1,transmitPin,9600) on the transmit end to initialize where transmitPin is the I/O pin you're using. You'd call serial.tx(byteValue) periodically to transmit a byte to the other end.

    On the receive side, you'd call serial.init(receivePin,-1,9600) to initialize it and have something like byteVariable := serial.rx to wait for the next byte to be sent and store it in the variable.

    Both the transmit and receive end could be running in their own cog. The transmit cog would send a byte every so often and the receive cog would wait for that value to be sent. The .init call would have to be done during the initialization of the cog's method rather than in your main program's initialization.
  • stargazer2050stargazer2050 Posts: 89
    edited 2012-11-10 09:01
    Webinar 2009-3-17 -9a mentions clockin method or something
    The Propalot uses IR and not serial for some reason
  • stargazer2050stargazer2050 Posts: 89
    edited 2012-11-10 09:12
    Ok michael, i will set this up and test.
    Not familiar with use of expression 'serial.rx' although i see it occasionally
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-11-10 09:24
    Parallax Serial Terminal (PST) has method for sending and receiving numbers.

    If you use the "dec" method to send a number followed by a carriage return "Char(13)", then the other Propeller can use PST's "DecIn" method to receive the number.

    This is explained a little in post #13 of this thread.
  • Mike GreenMike Green Posts: 23,101
    edited 2012-11-10 09:27
    Most objects in the Propeller Object Exchange come with demo programs that illustrate the use of the object. It's also a convention that the comments at the start of each method in the object and the comments at the beginning of the object document the object and the public methods. You need to look at them.
Sign In or Register to comment.