:Revision=5
:html
<<
128.152
RS232-Object|RS232
$NoSort
--
The IP-Object <!RW>RS232 provides access to the RS232-interface (COM-Ports).

The ports are addressed with the names defined in the basic setup, not by their port number! 

The interface parameters are set in the basic setup as well.
>>

<<
128.152.1
Functions of the RS232-Object|Functions
--
>>
<<
128.152.1.1
RS232.IsActive|IsActive
--
<!DEF>
function <!TW>RS232.IsActive : real;
<!TXT>
Returns <!RW>TRUE, if the serial ports are activated.


<!DEF>
function <!TW>RS232.IsActive (sName : string);
<!TXT>
Returns <!RW>TRUE, if the serial port <!PW>sName is activated.
>>
<<
128.152.1.2
RS232.IsOpen|IsOpen
--
<!DEF>
function <!TW>RS232.IsOpen (sName) : real;
<!TXT>
Returns <!RW>TRUE, if the serial port <!PW>sName is open.
>>
<<
128.152.1.3
RS232.Error|Error
!128.152.3 - Error codes
--
<!DEF>
function <!TW>RS232.Error (sName) : real;
<!TXT>
Returns the current error code of the serial port <!PW>sName.
>>
<<
128.152.1.4
RS232.ByteAvailable|ByteAvailable
--
<!DEF>
function <!TW>RS232.ByteAvailable (sName : string) : real;
<!TXT>
Returns the number of characters in the receive buffer of the serial port <!PW>sName
>>
<<
128.152.1.5
RS232.Read|Read
--
<!DEF>
function <!TW>RS232.Read (sName : string [; rTimeout : real [; rYield : real]]) : string;
<!TXT>
Reads a string from the serial port <!PW>sName. If <!PW>rTimeout is not specified, the value from the basic setup is used. The string end recognition is made with the Input-EOS-Sequence.

If <!PW>rTimeout [ms] is not given or -1, the timeout value of the basic setup will be used.

The end of the string is detected when the Input-End-Of-String sequenz is found.

If True is used by the parameter <!PW>rYield the TMCE is reachable and the function slow. 
If False is used by the parameter <!PW>rYield the TMCE is not reachable and the function fast. 
>>
<<
128.152.1.6
RS232.Get|Get
--
<!DEF>
function <!TW>RS232.Get (sName : string; rMin, rMax : real [; rTimeout : real [; rYield : real]]) : string;
<!TXT>
Reads characters from the serial port <!PW>sName. 

If <!PW>rTimeout [ms] is not specified or -1, the value from the basic setup is used.

The routine waits until either the timeout period is over or <!PW>rMax characters have been read in.

If the timeout period is over and at least <!PW>rMin characters have been read in, this is NOT valued as Timeout.

EOS-Sequences are not taken used.

If True is used by the parameter <!PW>rYield the TMCE is reachable and the function slow. 
If False is used by the parameter <!PW>rYield the TMCE is not reachable and the function fast. 
>>

<<
128.152.1.7
RS232.CTS|CTS
--
<!DEF>
function <!TW>RS232.CTS (sName : string) : real;
<!TXT>
Returns the state of the signal line <!SW>CTS (Clear To Send).
>>
<<
128.152.1.8
RS232.DSR|DSR
--
<!DEF>
function <!TW>RS232.DSR (sName : string) : real;
<!TXT>
Returns the state of the signal line <!SW>DSR (Data Set Ready).
>>
<<
128.152.1.9
RS232.DCD|DCD
--
<!DEF>
function <!TW>RS232.DCD (sName : string) : real;
<!TXT>
Returns the state of the signal line <!SW>DCD (Data Carrier Detected).
>>
<<
128.152.1.10
RS232.RI|RI
--
<!DEF>
function <!TW>RS232.RI (sName : string) : real;
<!TXT>
Returns the state of the signal line <!SW>RI (Ring Indicator).
>>
<<
128.152.1.11
RS232.Exists|Exists
--
<!DEF>
function <!TW>RS232.Exists (sName : string) : real;
<!TXT>
Returns <!RW>TRUE, if a serial port with the name <!PW>sName is defined.
>>

<<
128.152.1.12
RS232.OutBuffUsed|OutBuffUsed
--
<!DEF>
function <!TW>RS232.OutBuffUsed (sName : string) : real;
<!TXT>
Returns the number of characters that are still unsent in the output buffer of serial port <!PW>sName.

Remark: This value will be updated on a non regular basis - not for every single character. So it will go down to zero in jumps. 
A value of zero doesn't mean that there is no data sent anymore, only the software buffer is empty. There might be data in the FIFO of the UART or in the shift register of the UART.
>>

<<
128.152.1.13
RS232.OutBuffFree|OutBuffFree
--
<!DEF>
function <!TW>RS232.OutBuffFree (sName : string) : real;
<!TXT>
Returns the number of characters taht can be put in the output buffer of serial port <!PW>sName without a buffer overrun.

Remark: This value will be updated on a non regular basis - not for every single character. So it will go up/down in jumps. 
>>

<<
128.152.1.14
RS232.GetEOS|GetEOS
--
<!DEF>
procedure <!TW>RS232.GetEOS (sName : string; rSelect : real) : string;
<!TXT>
Retruns the <!SW>EOS/SOS - Sequences of the serial port <!PW>sName. 

<!PW>rSelect selects the sequence:


<!STBL>
<!>0<!>Input Start-Of-String (is ignored at the moment)<!>
<!>1<!>Input End-Of-String<!>
<!>2<!>Output Start-Of-String<!>
<!>3<!>Output End-Of-String<!>
<!ETBL>
>>
<<
128.152.1.15
RS232.GetPortnumber|GetPortnumber
--
<!DEF>
function <!TW>RS232.GetPortnumber (sPortName : string) : real;
<!TXT>
Returns the physical COM Port from <!PW>sPortNamek.

>>

<<
128.152.1.16
RS232.GetBaudrate|GetBaudrate
--
<!DEF>
function <!TW>RS232.GetBaudrate (sPortName : string) : real;
<!TXT>
Returns the baud rate from <!PW>sPortName.

>>

<<
128.152.1.17
RS232.GetDataBits|GetDataBits
--
<!DEF>
function <!TW>RS232.GetDataBits (sPortName : string) : real;
<!TXT>
Returns the count of data bits from <!PW>sPortName.

>>

<<
128.152.1.18
RS232.GetParity|GetParity
--
<!DEF>
function <!TW>RS232.GetParity (sPortName : string) : string;
<!TXT>
Returns the parity from <!PW>sPortName.

>>

<<
128.152.1.19
RS232.GetStopBits|GetStopBits
--
<!DEF>
function <!TW>RS232.GetStopBits (sPortName : string) : real;
<!TXT>
Returns the count of the stop bits from <!PW>sPortName.

>>

<<
128.152.1.20
RS232.GetRcvTimeOut|GetRcvTimeOut
--
<!DEF>
function <!TW>RS232.GetRcvTimeOut (sPortName : string) : real;
<!TXT>
Returns the timeOut of the receive from <!PW>sPortName.

>>

<<
128.152.1.21
RS232.GetRcvEOS|GetRcvEOS
--
<!DEF>
function <!TW>RS232.GetRcvEOS (sPortName : string) : string;
<!TXT>
Returns the excpected End Of String (EOS) by the receive of data from <!PW>sPortName.

>>

<<
128.152.1.22
RS232.GetRmRcvEOSState|GetRmRcvEOSState
--
<!DEF>
function <!TW>RS232.GetRmRcvEOS (sPortName : string) : string;
<!TXT>
The funktions name stand up for Get Remove (RM) Received (RCV) End of String (EOS) State and returns true if the EOF should be removed automaticly.

>>

<<
128.152.1.23
RS232.GetSendSOS|GetSendSOS
--
<!DEF>
function <!TW>RS232.GetSendSOS (sPortName : string) : string;
<!TXT>
Returns the Start Of String (SOS), which will be added by sending with <!PW>sPortName.

>>

<<
128.152.1.24
RS232.GetSendEOS|GetSendEOS
--
<!DEF>
function <!TW>RS232.GetSendEOS ( sPortName : string ) : string;
<!TXT>
Returns the End Of String (SOS), which will be added by sending with <!PW>sPortName.

>>


<<
128.152.2
Procedures of the RS232-Object|Procedures
--
>>
<<
128.152.2.1
RS232.Open|Open
--
<!DEF>
procedure <!TW>RS232.Open (sName : string);
<!TXT>
Opens the serial port <!PW>sName.
>>
<<
128.152.2.2
RS232.Close|Close
--
<!DEF>
procedure <!TW>RS232.Close (sName : string);
<!TXT>
Closes the serial port <!PW>sName.
>>
<<
128.152.2.3
RS232.RTS|RTS
--
<!DEF>
procedure <!TW>RS232.RTS (sName : string; rOperation : real);
<!TXT>
Manipulates the <!SW>RTS-Pin of the serial port <!PW>sName.

<!PW>rOperation can be : <!RW>CLR | <!RW>SET | <!RW>FLIP | <!RW>NOP or 0..3
>>
<<
128.152.2.4
RS232.DTR|DTR
--
<!DEF>
procedure <!TW>RS232.DTR (sName : string; rOperation : real);
<!TXT>
Manipulates the <!SW>DTR-Pin of the serial port <!PW>sName.

<!PW>rOperation can be : <!RW>CLR | <!RW>SET | <!RW>FLIP | <!RW>NOP or 0..3
>>
<<
128.152.2.5
RS232.Setup|Setup
--
<!DEF>
procedure <!TW>RS232.SETUP (sName : string; rBaud, rData, rParity, rStop : real);
<!TXT>
Sets the communication parameters of the serial port <!PW>sName

 <!PW>rBaud = 1..1000000
 <!PW>rData = 5..8
 <!PW>rStop = 1..2
 <!PW>rParity = 0..4 (none, odd, even, mark, space)
>>

<<
128.152.2.6
RS232.SetEOS|SetEOS
--
<!DEF>
procedure <!TW>RS232.SETEOS (sName : string; rSelect : real; sEOS : string);
<!TXT>
Sets the <!SW>EOS/SOS - Sequences of the serial port <!PW>sName. 
<!PW>rSelect selects which sequence should be set:
<!STBL>
<!>0<!>Input Start-Of-String (is ignored at the moment)<!>
<!>1<!>Input End-Of-String<!>
<!>2<!>Output Start-Of-String<!>
<!>3<!>Output End-Of-String<!>
<!ETBL>
>>

<<
128.152.2.7
RS232.Send|Send
--
<!DEF>
procedure <!TW>RS232.Send (sName : string; .Data : string|vector);
<!TXT>
Sends the string <!PW>Data (resp. the byte vector <!PW>Data) decorated with the Output-SOS and -EOS sequences on the serial port <!PW>sName.
>>
<<
128.152.2.8
RS232.Put|Put
--
<!DEF>
procedure <!TW>RS232.Put (sName : string; .Data : string|vector);
<!TXT>
Sends the string <!PW>Data (resp. the byte vector <!PW>Data) on the serial port <!PW>sName (without using Output-SOS and -EOS sequences)
>>
<<
128.152.2.9
RS232.ClearInBuffer|ClearInBuffer
--
<!DEF>
procedure <!TW>RS232.ClearInBuffer (sName : string);
<!TXT>
Clears the receive buffer of the serial port <!PW>sName.
>>
<<
128.152.2.10
RS232.ClearOutBuffer|ClearOutBuffer
--
<!DEF>
procedure <!TW>RS232.ClearOutBuffer (sName : string);
<!TXT>
Clears the send buffer of the serial port <!PW>sName.
>>

<<
128.152.3
Error codes of the RS232-Object|Errorcodes
--
<!STBL>
<!+>Code<!+>Meaning<!>
<!c>0<!>everything okay<!>
<!c>1<!>Port not opened (or inactive)<!>
<!c>2<!>Exception (unexpected error)<!>
<!c>3<!>Timeout while waiting for data<!>
<!ETBL>
>>

