Shop OBEX P1 Docs P2 Docs Learn Events
Serial Communication — Parallax Forums

Serial Communication

eduardomoraiseduardomorais Posts: 11
edited 2010-11-08 13:21 in Propeller 1
Hello everybody!
I'm new in using the serial communication board ... especially ussando parallax.

I would write a program in which parallax to receive a byte sent from the computer, store it in a buffer and returns this byte back to the computer.
Even seemingly simple ... I'm lot of trouble!

I tried the following program, but did not work.
Does anyone have any idea?

CON

_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000

VAR
byte buffer[16]

OBJ

pc: "Parallax Serial Terminal"

PUB Main
pc.StartRxTx(31, 30, 0, 9600)

repeat
pc.StrIn(@MyData)
pc.Str(@MyData)
waitcnt(clkfreq + cnt)

DAT

MyData byte 16

Comments

  • KyeKye Posts: 2,200
    edited 2010-11-08 12:21
    [FONT=Arial][COLOR=#a0522d]CON
    
    _clkmode = xtal1 + pll16x
    _xinfreq = 5_000_000
    
    VAR
    byte buffer[16]
    
    OBJ
    
    pc: "Parallax Serial Terminal"
    
    PUB Main
    pc.StartRxTx(31, 30, 0, 9600)
    
    repeat
      pc.StrIn(@buffer)
      pc.Str(@buffer)
    
    DAT
    
    MyData byte 16 [/COLOR][/FONT]
     
    

    Should work now.
  • eduardomoraiseduardomorais Posts: 11
    edited 2010-11-08 13:21
    I discovered I had made a mistake in class that I created in C + +.
    The following program works:
    CON

    _clkmode = xtal1 + pll16x
    _xinfreq = 5_000_000

    OBJ

    pc: "Parallax Serial Terminal"

    PUB Main
    pc.StartRxTx(31, 30, 0, 9600)

    repeat
    pc.StrIn(@MyData)
    pc.Str(@MyData)
    waitcnt(clkfreq + cnt)

    DAT

    MyData byte 16
    Anyway thanks Kye.
Sign In or Register to comment.