EasyManua.ls Logo

Topcon OPUS A6G2 - Page 551

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...
551
OPUS Projektor Manual
JavaScript
read again, 255 will be returned (see example below)! The handling of such data is up
to the script programmer!
Examples (see writeEEPROM for the according write functions):
var x = readEEPROM(0, 4, "number"); //read 4 bytes from postion
0, interpret the data as a number
print("Read 0xdeadbeef: " + x);
//console output: Read 0xdeadbeef: -559038801
Why -559038801?
0xdeadbeef in binary is 1101 1110 1010 1101 1011 1110 1010 1111 (32 bits).
According to the note above, the 1 in the highest bit is interpreted as the sign.
1101 1110 1010 1101 1011 1110 1010 1111 as a 32 bit signed number is -559038801
var n = readEEPROM(4, 2, "number"); //read 2 bytes from postion
4, interpret the data as a number
print("Read 32767: " + n);
//console output: Read 32767: 32767
var str = readEEPROM(6, 20, "string"); //read 20 bytes from
postion 6, interpret the data as a string
print("Read str: " + str);
//console output: Read str: Hallo Test!
Why "Hallo Test!", even though 20 bytes are read?
As seen below, the positions 6 to 16 (11 bytes -> 11 characters in "Hallo Test!") are filled with
the letters. The rest was set to 0. 0 is interpreted as the stop sign (i.e. the end of a string).
var b = readEEPROM(26, 1, "bool");
print("Read b: " + b);
//console output: Read b: true
var minus1 = readEEPROM(27, 1, "number");
print("Read minus1: " + minus1);
//console output: Read minus1: 255
Why 255? -1 in binary is, in 32 bit, 1111 1111 1111 1111 1111 1111 1111 1111).
But only 1 byte is stored. 1111 1111 equals 255.
var b16 = readEEPROM(28, 2, "number");
print("Read 16bit 0x55: " + b16);
//console output: Read 16bit 0x55: 85
var arr = readEEPROM(0, 29);
for (var i = 0; i < arr.length; ++i)
{
print("arr[" + i + "]: " + arr[i]);
}

Table of Contents