PDA

View Full Version : Serial Communication



eduardomorais
11-08-2010, 06:43 PM
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

Kye
11-08-2010, 08:21 PM
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



Should work now.

eduardomorais
11-08-2010, 09:21 PM
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.