Shop OBEX P1 Docs P2 Docs Learn Events
FullDuplexSerial - send data back to pc — Parallax Forums

FullDuplexSerial - send data back to pc

Robot FreakRobot Freak Posts: 168
edited 2008-04-15 20:47 in Propeller 1
Hello,

The idea is that the Propeller will return everything I type in on the computer.
But when I type ten times "AA", the Propeller returns ten different things.
Here is my program:
CON
_clkmode = xtal1 + pll16x         'set clock frequency 
_xinfreq = 5_000_000

VAR
  byte temp 

OBJ
serial : "FullDuplexSerial"          'fullduplexserial object

PUB main
serial.start(31, 30, 1, 9600)       'start fullduplexserial on the programming pins, with inverted communications, at a baudrate of 9600
serial.str(string("Hello World!"))    'transmit the string Hello World!
repeat
  temp := serial.rx
  if !(temp == $00)
    serial.bin(temp,8)
  waitcnt(50_000 + cnt)


Am I missing something?
Or am I saving the rx in a wrong variable?

Kind regards,
Robot Freak

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-04-15 19:30
    Your program may be doing exactly what you asked. After sending "Hello World1", it sends the non-zero characters it receives as binary numbers consisting each of 8 "0" or "1" characters. If you enter the letter "A", it will return "01000001". Note that FullDuplexSerial is only inverting the received data. If you want the transmitted data to be inverted as well, the mode parameter has to be 3, not 1.
  • Robot FreakRobot Freak Posts: 168
    edited 2008-04-15 20:38
    This is what I am receiving: (the A's are on the computer side, rest is from the prop)
    Hello World!A
    1011111011101011A
    1101000010101101A
    0101111100111101A
    1110100010101101A
    0111110111101011A
    100000001010111100111101A
    0100000010101101A
    1010000010101101A
    0101111100111101A
    1111010010101101A
    1110100010101101A
    0100000010101101A
    0101111100111101A
    1101000010101101A
    1011111011101011A
    1010000010101101A
    0111110111101011
    


    After resetting the prop, I get this:
    Hello World!A
    1111010010101101A
    1011111011101011A
    1111101010101101A
    1101000010101101A
    1010000010101101A
    0100000010101101
    


    So it looks like there isn't any pattern...
  • Robot FreakRobot Freak Posts: 168
    edited 2008-04-15 20:47
    It is working now!
    I tried changing the mode parameter, and 0 seems to work.

    Thanks for mentioning it!
Sign In or Register to comment.