PDA

View Full Version : Serial Communication



eduardomorais
11-20-2010, 06:06 PM
Hello everyone!

I have a question about how he could control a buffer in communication between the computer and parallax.
How do I compare to securely deliver information I'm getting the computer in the form of bytes, with a reference value?

Below is a code I made for the function of ascending desemprenhar LEDs according to comparison even. However it is not working properly.:confused:
------------------------------------------------------------------------

CON

_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000

OBJ

Parallax: "Nomad"
PC: "FullDuplexSerial"


PUB Main

Parallax.start(0, 0, 19_200)

PC.start(31, 30, 0, 9_600)

Repeat
dirA[16..23]~~

longfill(@rx_comando, 0, 4)

rx_comando := PC.RX

'My question is why this works
'-----------------------------
CASE || rx_comando
QPOS : !outA[16]

CLRP : !outA[23]
'------------------------------

longmove(@tx_comando, @rx_comando, 1)

PC.TX(tx_comando)

waitcnt(clkfreq + cnt)

DAT

rx_comando long

tx_comando long

QPOS byte "08", 0
CLRP byte "28", 0

T Chap
11-20-2010, 06:13 PM
Hi Eduardo

It would be easier to read the code if you can edit it and put brackets at the top and bottom of the code

At the top of the code put the word "code" inside these brackets [ ] at the bottom of the code put the word "/code" in brackets. This way all your indention is retained.