FullDuplexSerialPlus - tx method
CHAD.G
Posts: 11
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
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
Isn't this the byte you want to send out the serial port? - 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.
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
object.tx(byte) transmits one byte from the pin, at the baud rate, using the mode specified by the object's start method.
What do you expect? The receiver receives, what? Nothing?
In the code posted the tx method clears the terminal window.
Then waits for an input from the terminal window.
Thanks.
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!
You got it figured out.. cool.