Products Downloads


French version


 

Closes the connection to the serial port selected by the object.

Syntax

CALL_METHOD NameSerialPortObject CLOSE

Conditions for use

To close the serial port, it must have been opened previously.

 

 

Opens the connection to the object's serial port. The result of the operation appears in the parameter OP_OK. The latter will be set to "*TRUE" if the connection was successful; otherwise it will be set to "*FALSE".

Syntax

CALL_METHOD NameSerialPortObject OPEN OP_OK

Parameters

OP_OK

BOOL type.

Conditions for use

Once an OPEN method has been used to open the serial port, a second OPEN must not be used. To prevent errors, the button triggering the opening of the serial port is dimmed.

 

 

Reads characters from the serial port and stores them in a Buffer of capacity MaxSize, then returns the number of words read NbRead.

The result of the operation also appears in the parameter OP_OK. The latter will be set to "*TRUE" if the operation was successful; otherwise it will be set to "*FALSE".

Note that in UNICODE, read characters are considered as being converted in the system's ANSI code page.

Syntax

CALL_METHOD NameSerialPortObject READ_ALPHA Buffer MaxSize NbRead OP_OK

Parameters

Buffer

ALPHA type

MaxSize

NUM_BIN_4 type

NbRead

NUM_BIN_4 type

OP_OK

BOOL type

Conditions for use

This method can be called only after opening the serial port.

 

 

Reads characters on the serial port, with the specified coding, placing them in the Buffer with a size of MaxSize characters.

 

The possible coding values are:

• _SRP_ASCII – ASCII coding

• _SRP_ANSI – ANSI coding

• _SRP_UNICODE - UNICODE coding (UTF16)

 

Returns the number of words read (NbRead) and the result of the operation in the OP_OK parameter. If the operation was successful, this parameter is *TRUE; if not, it is *FALSE.

 

Syntax

CALL_METHOD NameSerialPortObject READ_ALPHA_ENC Buffer MaxSize NbRead Encoding OP_OK

Parameters

Buffer

ALPHA type

MaxSize

NUM_BIN_4 type

NbRead

NUM_BIN_4 type

Encoding

NUM_BIN_4 type

OP_OK

BOOL type

Conditions for use

This method can be called only after opening the serial port.

 

 

Reads all types of data from the serial port and stores its decimal values in a Buffer of capacity MaxSize, then returns the number of words read NbRead.

The result of the operation appears in the parameter OP_OK. The latter will be set to "*TRUE" if the operation was successful; otherwise it will be set to "*FALSE".

Syntax

CALL_METHOD NameSerialPortObject READ_BINARY Buffer MaxSize NbRead OP_OK

Parameters

Buffer

NUM_BIN_2 type array

MaxSize

NUM_BIN_4 type

NbRead

NUM_BIN_4 type

OP_OK

BOOL type

Conditions for use

This method can be called only after opening the serial port.

 

 

Writes the characters contained in Buffer to the serial port in Nb bytes.

It also returns the result of the operation in the parameter OP_OK. If the operation was completed successfully, OP_OK will be set to "*TRUE", otherwise it will be set to "*FALSE".

Note that in UNICODE, sent characters are converted in the system's ANSI code page.

Syntax

CALL_METHOD NameSerialPortObject WRITE_ALPHA Buffer Nb OP_OK

Parameters

Buffer

ALPHA type

Nb

NUM_BIN_4 type

OP_OK

BOOL type

 

 

Conditions for use

This method can be called only after opening the serial port.

 

 

Writes the characters contained in Buffer to the serial port on Nb characters using the specified coding, and returns the result of the operation in the OP_OK parameter.

If the operation was successful, this parameter is *TRUE; if not, it is *FALSE.

 

The possible coding values are:

• _SRP_ASCII – ASCII coding

• _SRP_ANSI – ANSI coding

• _SRP_UNICODE - UNICODE coding (UTF16)

 

Syntax

CALL_METHOD NameSerialPortObject WRITE_ALPHA_ENC Buffer Nb Encoding OP_OK

Parameters

Buffer

ALPHA type

Nb

NUM_BIN_4 type

Encoding

NUM_BIN_4 type

OP_OK

BOOL type

Conditions for use

This method can be called only after opening the serial port.

 

 

Writes all types of data contained in Buffer to the serial port (as decimal values) on Nb bytes.

It also returns the result of the operation in the parameter OP_OK. If the operation was completed successfully, OP_OK will be set to "*TRUE", otherwise it will be set to "*FALSE".

Syntax

CALL_METHOD NameSerialPortObject WRITE_BINARY Buffer Nb OP_OK

Parameters

Buffer

NUM_BIN_2 type array

Nb

NUM_BIN_4 type

OP_OK

BOOL type

 

 

Conditions for use

This method can be called only after opening the serial port.

 

 

 

 

 

 

↑ Top of page