Shop OBEX P1 Docs P2 Docs Learn Events
extended full duplex communication — Parallax Forums

extended full duplex communication

avionikerenavionikeren Posts: 63
edited 2008-03-31 23:42 in Propeller 1
I want to recieve a string with the propeller and I guess the extended full duplex object would do the job.
But I can`t find out how to do it...

The string is sent from a visual basic program·with rs232. I can·of course change the delimiter,
but I have been using carriage return earlier when the program has communicated with a BS2PX.
I have also added a character in start and end of the string so I can check that the hole string has been recieved.

Is it possible to do the same with a propeller?

String example:

s
101
188
135
054
083
172
003
e

·

Comments

  • Martin HebelMartin Hebel Posts: 1,239
    edited 2008-03-30 04:17
    When you say you can change the delimiter, do you mean on the PC side, or simply in the EXT_FD object?

    Instead of delimited, your could simply accept each one at a time:

    Repeat                                 ' wait for s
       Start := Ser.RxTime(100)
    Loop until start == "s"
    
    val1 := Ser.RxDecTime(100)  ' accept each value
    Val2 := Ser.RxDecTime(100)
    etc for all values
    
    Stop := Ser.RxTime(100)        ' check for stop
    If Stop == "e"
       ....
    
    



    Not tested!!

    -Martin
  • avionikerenavionikeren Posts: 63
    edited 2008-03-30 09:42
    Thanks a lot, I think this is just what I need!

    Yes I ment to change the delimiter on the pc side, but as long as this work with carriage return, it`s· perfect...
  • avionikerenavionikeren Posts: 63
    edited 2008-03-30 23:26
    I have been searching around and found another similar project and ended up with this code:
    PUB main
     dira[noparse][[/noparse]15]~~   
     Serial.start(6,8,0,19200)
     serial.SetDelimiter(",")
     serial.rxflush
     repeat
        repeat while (serial.rx <> "s")
        serial.RxStrTime(1,@dataStr1)       
        serial.RxStrTime(1,@dataStr2)
        serial.RxStrTime(1,@dataStr3)
        serial.RxStrTime(1,@dataStr4)
        serial.RxStrTime(1,@dataStr5)
        serial.RxStrTime(1,@dataStr6)
        serial.RxStrTime(1,@dataStr7)
        serial.RxStrTime(1,@dataStr8)
        serial.RxStrTime(1,@dataStr9)
        serial.RxStrTime(1,@dataStr10) 
        !outa[noparse][[/noparse]15]
        waitcnt(1_000_000 + cnt)
    
    

    I have added a LED at pin 15 just to see that it runs. but it will only run when the "repeat while" line is removed.
    I know that the "s" is transmitted from the computer, because a basic stamp recieves it with no trouble...

    What could be wrong?
  • avionikerenavionikeren Posts: 63
    edited 2008-03-31 10:49
    I have hooked up a computer with hyper terminal and when I send out a character with the propeller,I recieve a different character on the computer. i.e. a "s" becomes a "$" and a "S" becomes a "%", what can that be? the propeller use standard ASCII doesn`t it?
  • StefanL38StefanL38 Posts: 2,292
    edited 2008-03-31 10:58
    hello avionikeren,

    did you check that ALL parameters are correct:
    baudrate, databits, stopbits, paritybits ?

    did you receive the SAME but wrong characters every time?

    if not
    is only one method sending out data at the same time?

    what is the hardware you are using ? (maybe Problem of voltage-levels, lack of or too small capacitors used with voltagelevelshifter

    did you test on the propeller itself with a closed loop (Prop-TX-PIN directly connected to Prop-RX-PIN
    and checking the data with TV-object or something like that?

    regards

    Stefan
  • avionikerenavionikeren Posts: 63
    edited 2008-03-31 13:27
    yes, I recieve the same but wrong characters every time.

    I have·tried all settings on the hyper terminal, but none outputs the correct character.

    I do not have the correct resistors to make the TV output.
  • StefanL38StefanL38 Posts: 2,292
    edited 2008-03-31 15:03
    hello,

    PLAYING ARAOUND with the parameters does not lead to the target did you COMPARE every detail
    of the parameters between propeller and terminalsoftware ?

    ok we'll gonna make another small step

    program a loop that starts at value 32 up to 255

    send with command .tx(value) and post the result here

    another thing is to try another terminalsoftware hyperterminal is quite not comfortable

    here is a link for downloading another terminalsoftware

    http://forums.parallax.com/forums/default.aspx?f=25&m=169419&p=1&ord=d
  • avionikerenavionikeren Posts: 63
    edited 2008-03-31 22:39
    thanks a lot for the tip about the terminal program, really nice!!
    the problem was that I had to set the mode bit to 3, but I can`t see why?

    '' mode bit 0 = invert rx
    '' mode bit 1 = invert tx
    '' mode bit 2 = open-drain/source tx
    '' mode bit 3 = ignore tx echo on rx
    
    
  • JonathanJonathan Posts: 1,023
    edited 2008-03-31 23:42
    If you passed a "3" as a parameter, I think it will translate to %11, which is invert tx/rx

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
Sign In or Register to comment.