#Include <CommMG.au3>
$data = StringToBinary("test123")
Local $sErr
$connect = _CommSetPort(4, $sErr, 9600, 8, 0, 1, 0, 0, 0)
_CommSendString($data)
_CommCloseport()
Exit
;НАСТРОЙКА _CommSetPort()
;
; Parameters: $iPort - integer = the port or COM number to set. Allowed values are 1 or higher.
; NB WIndows refers To COM10 Or higher`as \\.\com10 but only use the number 10, 11 etc
; $sErr - string: the string to hold an error message if func fails.
; $iBaud - integer: the baud rate required. With commg.dll v2.3 and later any value allowed up to 256000.
; With v2.4 any value??
; If using commg.dll before V2.3 then only allowed values are one of
; 50, 75, 110, 150, 600, 1200, 1800, 2000, 2400, 3600, 4800, 7200, 9600, 10400,
; 14400, 15625, 19200, 28800, 38400, 56000, 57600, 115200, 128000, 256000
; $iBits - integer: number of bits in code to be transmitted
; $iParity - integer: 0=None,1=Odd,2=Even,3=Mark,4=Space
; $iStop - integer: number of stop bits, 1=1 stop bit 2 = 2 stop bits, 15 = 1.5 stop bits
; $iFlow - integer: 0 sets hardware flow control,
; 1 sets XON XOFF control,
; 2 sets NONE i.e. no flow control.
; $RTSMode 0= turns on the RTS line when the device is opened and leaves it on
; 1= RTS handshaking. The driver raises the RTS line when the "type-ahead" (input) buffer is less than one-half full and lowers the RTS line when the buffer is more than three-quarters full.
; 2 = the RTS line will be high if bytes are available for transmission. After all buffered bytes have been sent, the RTS line will be low.
; 3 = turns off the RTS line when the port is opened and leaves it off
; $DTRMode 0 = turns on the DTR line when the port is opened and leaves it on
; 1 = enables DTR handshaking
; 2 = disables the DTR line when the device is opened and leaves it disabled.