Shop OBEX P1 Docs P2 Docs Learn Events
FullDuplexSerialPlus - tx method — Parallax Forums

FullDuplexSerialPlus - tx method

CHAD.GCHAD.G Posts: 11
edited 2011-03-13 18:32 in Propeller 1
In the FullDuplexSerialPlus object, what is the tx method's input argument used for? I can't seem to figure it out and I've ran codes from the PE Kit where changing the value of txbyte doesn't have any effect on the outcome. Here's a copy of the tx method:


PUB tx(txbyte)

'' Sends byte (may wait for room in buffer)

repeat until (tx_tail <> (tx_head + 1) & $F)
tx_buffer[tx_head] := txbyte
tx_head := (tx_head + 1) & $F

if rxtx_mode & %1000
rx

Comments

  • Dr_AculaDr_Acula Posts: 5,484
    edited 2011-03-12 18:42
    what is the tx method's input argument used for?
    You mean txbyte?

    Isn't this the byte you want to send out the serial port?
    where changing the value of txbyte doesn't have any effect on the outcome
    - how are you sending bytes out at the moment - writing directly to the buffer?

    Have you got anything meaningful out of the serial port? eg tested with a terminal program.

    Did you run the Start first, to set up the port?

    Could you post your entire program - that might make it easier to debug.
  • CHAD.GCHAD.G Posts: 11
    edited 2011-03-13 17:44
    Dr_Acula wrote: »
    Could you post your entire program - that might make it easier to debug.

    I'm just working with code from the PE Fundamentals Kit at the moment. For example, the TerminalLedControl object provided in the kit. See attachment for .spin file or the copy and paste below.

    OBJ

    Debug : "FullDuplexSerialPlus"


    PUB TerminalLedControl

    ''Set/clear I/O pin output states based binary patterns
    ''entered into Parallax Serial Terminal.

    Debug.start(31, 30, 0, 57600)
    waitcnt(clkfreq*2 + cnt)
    Debug.tx(Debug#CLS)
    dira[4..9]~~

    repeat

    Debug.Str(String("Enter 6-bit binary pattern: "))
    outa[4..9] := Debug.getBin
  • Mike GMike G Posts: 2,702
    edited 2011-03-13 17:57
    In the FullDuplexSerialPlus object, what is the tx method's input argument used for?

    object.tx(byte) transmits one byte from the pin, at the baud rate, using the mode specified by the object's start method.
    object.start(31, 30, 0, 57600)
    
    the value of txbyte doesn't have any effect on the outcome

    What do you expect? The receiver receives, what? Nothing?

    In the code posted the tx method clears the terminal window.
    object.tx(object#CLS)
    

    Then waits for an input from the terminal window.
    outa[4..9] := object.getBin 
    
  • CHAD.GCHAD.G Posts: 11
    edited 2011-03-13 18:05
    So in the TerminalLedControl object I included above, why is it I can have the txbyte input be 0, 1, 2, 3, ... , etc. and it doesn't appear to have an effect on the operation of the program?

    Thanks.
  • Mike GMike G Posts: 2,702
    edited 2011-03-13 18:11
    The program you posted is waiting for you to enter a value in the terminal window. object.tx(byte) sends a value to the terminal.

    Are you trying to write a message to the terminal window?
  • CHAD.GCHAD.G Posts: 11
    edited 2011-03-13 18:15
    Mike G wrote: »
    The program you posted is waiting for you to enter a value in the terminal window. object.tx(byte) sends a value to the terminal.

    Are you trying to write a message to the terminal window?

    Okay, okay, I got it! Sorry, was having a little brain cloud for a sec there. Thanks Mike!
  • Mike GMike G Posts: 2,702
    edited 2011-03-13 18:21
    Yeah, the input textbox in the Parallax Serial Terminal is subtle. It's easy to disregard the flashing cursor and focus on the blue display area.
  • CHAD.GCHAD.G Posts: 11
    edited 2011-03-13 18:27
    It was actually the clearing of the blue display area that I was not acknowledging. (I guess I shouldn't have quoted what I did in post #7)
  • Mike GMike G Posts: 2,702
    edited 2011-03-13 18:32
    I'm lost again... which is normal for me.

    You got it figured out.. cool.
Sign In or Register to comment.