Mioplanet Documentation Center
Resources and Help
HomeProductsMioScriptJavaScriptTechNotesPHP
   Home | MioScript | RS232.open SEARCH    

  Functions
RS232.checkSum
RS232.close
RS232.get
RS232.open
rs232.send

  MioScript Reference
> Statements
app...
browser...
dialog...
disk...
draw...
extern...
filename...
keyboard...
menu...
mio...
mouse...
num...
path...
pushButton...
reg...
RS232...
sci...
screen...
shortcut...
sound...
str...
system...
time...
var...
window...

Function
RS232.open

Language: MioScript
Product: MioFactory


Syntax

RS232.open(COM, baudRate, byteSize, parity, bitStop, abordOnError)


Parameters

STRINGCOMCOM port (COM1, COM2, COM3...COM255)
INTbaudRateOptional.
Baud rate, in bits per second (bps).
Default value is 9600.
INTbyteSizeOptional.
Byte Size.
Default value is 8.
STRINGparityOptional.
Parity. Can be:
NOPARITY (default)
EVENPARITY
MARKPARITY
ODDPARITY
SPACEPARITY
STRINGbitStopOptional.
ONESTOPBIT (default)
ONE5STOPBITS
TWOSTOPBITS
BOOLabordOnErrorOptional.
If set to true, the operation is aborted if an error occurs.
Default value is true.


Return value

Status.
true: Success.
-1: Serial port not found.
-2: Failed to open serial port
-3: Failed to set timeout.



Description

Opens the specified COM port to establish an RS-232 based communication with a device via a serial port.

The device can be connected to an USB port with a Serial To USB adapter.

It is possible to open any port com from 0 to 255. Only one COM port can be opened, but it is possible to create separate processes to control several COM ports from a single application.

When opened, a COM port cannot be used by another application.
You can close the COM port with {link:RS232:CLOSE}.




MioScript Sample Code

RS232.open("COM1")