Shop OBEX P1 Docs P2 Docs Learn Events
char — Parallax Forums

char

The old full duplexserial had a char value that can be displayed. I cannot find this in any of the P2 versions.
I do not know what I am missing.
I am simply taking gps data and prior to processing it wanting to send the ascii code to the display.
What am I missing.
Help please.
Thank you.

Comments

  • AribaAriba Posts: 2,682

    Most objects call it tx() or out()

  • That wasn't in FDS, it was in Parallax Serial Terminal. Here is

    PUB Char(bytechr)
    {{Send single-byte character.  Waits for room in transmit buffer if necessary.
      Parameter:
        bytechr - character (ASCII byte value) to send.}}
    
      repeat until (tx_tail <> ((tx_head + 1) & BUFFER_MASK))
      tx_buffer[tx_head] := bytechr
      tx_head := (tx_head + 1) & BUFFER_MASK
    
      if rxtx_mode & %1000
        CharIn
    

    As Andy points out, that was just another name for tx() -- this is from the original FDS.

    PUB Tx(txByte)
    {{
       Places a byte into the transmit buffer for transmission (may wait for room in buffer).
    
       Parameters: txByte = the byte to be transmitted
       return:     none
    
       example usage: serial.Tx($0D)
    
       expected outcome of example usage call: Transmits the byte $0D serially on the txPin
    }}
    
      repeat until (tx_tail <> (tx_head + 1) & $F)          'wait until the buffer has room                        
      tx_buffer[tx_head] := txByte                          'place the byte into the buffer
      tx_head := (tx_head + 1) & $F                         'advance the buffer's pointer
    
      if rxtx_mode & %1000                                  'if ignoring rx echo
        Rx                                                  '   receive the echoed byte and discard
    

    The original FDS has a 16-byte buffer, which is why $F is used as a mask.

Sign In or Register to comment.