Function EN Version 4.00

@ReadNTComPort

NTComPort

Syntax

@ReadNTComPort(OSCOMHANDLE1;RETTYPE2;LENGTH3;STATUS4);
@ReadNTComPort(OSCOMHANDLE1;RETTYPE2;LENGTH3;STATUS4;TIMEOUT5);
@ReadNTComPort(OSCOMHANDLE1;RETTYPE2;TEXT3;STATUS4);
@ReadNTComPort(OSCOMHANDLE1;RETTYPE2;TEXT3;STATUS4;TIMEOUT5);
@ReadNTComPort(OSCOMHANDLE1;RETTYPE2;TEXT3;STATUS4;TIMEOUT5;RETELE6);
@ReadNTComPort(OSCOMHANDLE1;RETTYPE2;TEXTLIST3;STATUS4);
@ReadNTComPort(OSCOMHANDLE1;RETTYPE2;TEXTLIST3;STATUS4;TIMEOUT5);
@ReadNTComPort(OSCOMHANDLE1;RETTYPE2;TEXTLIST3;STATUS4;TIMEOUT5;RETELE6);

Description

Only for Engine under Windows!

Reads a value from the COM port identified by OSCOMHANDLE OSCOMHANDLE1 and returns it as the result of the @Function. The value to be read is expected to be of the type specified by TEXT RETTYPE2.
Either one value is read for ordinal data types, or FN LENGTH3 characters are read. Alternatively, reading continues until TEXT TEXT3 or one of the elements of TEXTLIST TEXTLIST3 is detected. These delimiter strings are not included in the return value.

If FN TIMEOUT5 is specified, it overrides the globally configured timeout for this read operation. This timeout defines the maximum amount of time the read operation may take for the specified number of characters. Internally, this value is increased by 3 ms for each character read. If no length is specified, the timeout starts again after each character that is read.

If the variable NUMBER RETELE6 is specified, it receives the element number, based on TEXT3/TEXTLIST3, that caused the read operation to stop, or 0 in case of an error. TEXT TEXT3 is treated as a list with one element.

The success of the read operation can be determined using NUMBER STATUS4. If it receives the value 1, no error message is returned yet as the @Function result.

TEXT RETTYPE2 (zu lesender Typ):
value   Meaning
A      TEXT
B      BINARY (derzeit as RICHTEXT)
N      NUMBER (konvertiertes WORD)
F      FLOAT (konvertierter double)
L      FLOAT (konvertierter long)
D      FLOAT (konvertiertes DWORD)
T      TIMEDATE

NUMBER STATUS4 (return value):
value   Meaning
0      Message: OK, no error
1      message: Read Timeout abgelaufen
2      Error: maximum TEXT length exceeded (TEXT mode only!)
32768   Error: unspecified error

Example: @ReadNTComPort(OSCOMHANDLE1;RETTYPE2;LENGTH3;STATUS4)

OSCOMHANDLE1:=@OpenNTComPort("COM1");
@LogReport(@ReadNTComPort(OSCOMHANDLE1;"A";20;Status));
OSCOMHANDLE1:=@CloseNTComPort(OSCOMHANDLE1);

Opens a COM port, reads 20 text characters, outputs them, and then closes the COM port again.
Status contains the current read status.

Example: @ReadNTComPort(OSCOMHANDLE1;RETTYPE2;TEXT3;STATUS4)

OSCOMHANDLE1:=@OpenNTComPort("COM1");
@LogReport(@ReadNTComPort(OSCOMHANDLE1;"A";"*";Status));
OSCOMHANDLE1:=@CloseNTComPort(OSCOMHANDLE1);

Opens a COM port, reads text up to the first "*" character, outputs it, and then closes the COM port again.
Status contains the current read status.

Example: @ReadNTComPort(OSCOMHANDLE1;RETTYPE2;TEXTLIST3;STATUS4)

OSCOMHANDLE1:=@OpenNTComPort("COM1");
@LogReport(@ReadNTComPort(OSCOMHANDLE1;"A";"*":@Newline));
OSCOMHANDLE1:=@CloseNTComPort(OSCOMHANDLE1);

Opens a COM port, reads text up to the first "*" character or @Newline , outputs it, and then closes the COM port again.
Status contains the current read status.

Note : This text was machine-translated and may contain inaccuracies.