EasyManua.ls Logo

Topcon OPUS A6G2 - Page 564

Topcon OPUS A6G2
800 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
564
OPUS Projektor Manual
JavaScript
myRS232.writeFromBuffer("Special characters: 'ÄÖÜ äöü'\r\n");
// If the receiver expects special characters according to an
extended ASCII encoding
// the special characters have to be provided as an array of
numbers.
// If 'latin 1' (ISO 8859) is expected the same text as above
could look like this:
myRS232.writeFromBuffer("Special characters: '");
myRS232.writeFromBuffer([0xc4, 0xd6, 0xdc, 0x20, 0xe4, 0xf6,
0xfc]);
myRS232.writeFromBuffer("'\r\n");
// In order to convert the data sent to another character table
one can define the 'encoding' property of 'myRS232':
myRS232.encoding = "Windows-1252";
// Now even the special characters will only be sent as one
byte:
myRS232.writeFromBuffer("Special characters: 'ÄÖÜ äöü'\r\n");
Return values:
0 - write successful
2 - port is not opened yet
6 - writing failed
RS232Handler.readIntoBuffer - read data from serial interface
Calling this method reads all data currently available on the RS232 interface and stores it in a
number array.
Without a parameter, the method reads up to 1024 bytes.
With an optional parameter the number of bytes can be limited.
If no data is available, an empty array will be returned after the set wait time.
This method entirely relies on the buffering of the underlying driver.
Note that this is a very simple interface intended to e.g. read some configuration data from a
printer.
It is by no means designed to frequently read data e.g. from a GPS receiver or other similar
source.
If this warning should not prevent you from trying anyways: Expect lag in the PClient (drawing)
performance (as both share the same thread) and be aware that you have to manage getting
the data at the right time and in the right amount somehow without blocking the PClient with
'busy waiting'.
Prototype:
var number[] = RS232Handler.readIntoBuffer(number bytesToRead);
Example:
//Read the RS232 interface
var readArray = myRS232.readIntoBuffer();

Table of Contents