Purpose |
Send a string of text through a serial port with optional CR/LF. |
Syntax |
COMM PRINT [#] hComm, string_expression [;] [TO CharCountVar] |
Remarks |
The text data contained in string_expression is sent to the serial port associated with the file number hComm. The number symbol (#) is optional. The data is sent in the character form specified in the COMM OPEN statement. If CHR=WIDE was given, the data is sent in wide Unicode characters. Otherwise, it is sent in ANSI bytes. The data will be converted to the appropriate form automatically. This statement is a variation of COMM SEND, but is usually used with text only. Each string_expression sent is automatically followed by a Carriage-Return and Line-Feed pair to delimit the line. However, if a trailing semi-colon (;) is added, the CR/LF is suppressed. If the optional "TO CharCountVar" clause is included, a count of the number of characters written is assigned to it. This count includes the CR/LF, if utilized. This will allow you to gauge the success of the operation. If a TimeOut occurred, this value will be less than expected, and a run-time error 24 (Device Timeout) will be generated. COMM PRINT is ideal for sending "AT" commands to a modem. Omit the trailing semicolon for this purpose, since you would want the CR/LF to be sent along with the data. |
See also |
Serial Communications, COMM CLOSE, COMM function, COMM LINE, COMM OPEN, COMM RECV, COMM RESET, COMM SEND, COMM SET, COMM TIMEOUT |