Skip to main content

TXD

Syntax

TXD ( pin )

Description

TXD (pin) will send a single byte of data that is shifted out as an asynchronous serial stream on pin.  This function is similar to SEROUT,  but is a more efficient implementation.  The baudrate for the pin should be set before using TXD, that is done using the BAUD(pin) function. TXD will transmit 0-255 as a single byte of data with an added START bit and trailing STOP bit.  As this function is done byt the CPU (often referred to as bit-naging, the program will stay at this instruction until the shifting is completed.

If pin is 16 then data is transmitted on the SOUT pin.

Example

DIM A$(10)

BAUD(2) = 19200 ' set the baud rate for serial I/O
on pin 2

...

A$ = "Hello World"

GOSUB PRINTSTR

...

' Send a string of characters serially out pin 2

PRINTSTR:

I=0

WHILE A$(I)

TXD(2) = A$(I)

I=I+1

LOOP

RETURN

Differences from other BASICs

  • no equivalent in Visual BASIC
  • preferred alternate to SEROUT of PBASIC

See also