sendx statement

The sendx statement converts the exploded ASCII hexadecimal string results of str.exp to its binary equivalent and then transmits it to the specified port. The conversion process terminates when the first nonhexadecimal character is encountered. sendx suppresses the output of a CR/LF pair. sendx does not allow the : to exist as part of the statement.


sendx str.exp to port.num{then|else statement.block}


str.exp Specifies the output to be sent to the specified port number.
port.num Port number to which the output is sent.


The port to which the output is being sent must be attached with the TCL dev-att command.

In the sendx statement, the first expression is evaluated as a string. This string can contain any data formatting expressions that work in the print or crt statements, including cursor positioning, @(column,row), and special functions, @(-n). The actual codes that are generated is determined by the terminal characteristics of the process executing the send, not the port to which the characters are being passed. The correct terminal type must be established with the TCL term command.

port.num must evaluate to a valid port number. If the port number is invalid, and there is no else clause, the program aborts into the FlashBASIC or BASIC debugger. If there is an else clause, it is executed when the port number is invalid.

The sendx statement is typically used after a port has been attached by the sending process. Attachment ensures that the process has exclusive use of the port. Data can be sent to any port that is linked (but not attached) to another process. If the port is attached to another process, the else clause is executed.

Both the then and else clauses are optional, but, at least one must be specified.


The binary equivalent of the ASCII hexadecimal string in msg is sent to the port addressed by device1 and if successful, prints a message.

sendx msg to device1 then print ’hex message converted to binary and sent’