Writes bytes to the specified lPort COM port number.
[ lBytesSent = ] ComSend ( lPort , sEOS, lTimeout [, enMode] , pSrc [, lBytes] )
The ComSend procedure syntax has the following parts:
Name |
Type |
Description |
lBytesSent |
Long |
Number of bytes sent |
lPort |
Val Long |
Serial port number (1 for COM1, etc.) |
sEOS |
Val BString |
End Of Sequence string |
lTimeout |
Val Long |
Timeout in milliseconds |
enMode |
Output send mode. Only the default value is 0 (aioDefault) which can be combined with aioDisableBstrConvert. |
|
pSrc |
Val Any |
Send data buffer |
lBytes |
Val Long |
Maximum number of data bytes to send. When the default value (-1) is used the size of the send buffer pSrc is used. |
enumAIoMode can be one of the following values:
Name |
Value |
Description |
aioImmediate |
0 |
Receive on data available |
aioWaitGpibSrqVxiDor |
1 |
Receive on Srq (gpib) or on Dor (vxi) |
aioGpibImmediateOrSrq |
2 |
Receive on Immediate or Srq (gpib) |
aioDisableBstrConvert |
4 |
Disable conversion of BString to String, can be combined with one of the previous values. |
The lPort must be opened by calling ComOpen function or by configuring an RS232 driver in the System.
The sEOS can be 0-2 bytes long and specifies the data bytes that signal the end of data.
A value of -1 indicates an error has occurred.
The following example will send 4 bytes"F1\r\n" to the COM2 port, with an End of Sequence (EOS) string of carriage return/line feed, with a timeout of one second:
If ComSend(2, "\r\n", 1000, , "F1", 4)<>4
Abort
endif