The GP-Probe TGE2 is equipped with two ports:
- RS485/422. Port_ID = 1.
- RS232. Port_ID = 2.
Port initialization:
com.init(Port_ID, BaudRate, Parity, StopBits, Mode);
Port_ID. 1 - RS232, 2 - RS485/422
BaudRate - baud rate
Parity: "NONE", "EVEN", "ODD"
StopBits: 1, 2
Mode - optional argument, only used for RS485/422. Values: "RS485", "RS422".
Writing a string to the port:
com.write(Port_ID, string Data)
Port_ID. 1 - RS232, 2 - RS485/422
Data string
Reading a string from the port:
com.read(Port_ID, Timeout, Endchars)
Port_ID. 1 - RS232, 2 - RS485/422
Timeout - timeout of waiting for the Endchars in milliseconds. 4 bytes uint.
Endchars - character string. If at least one of them is found, the reception ends without waiting for a timeout. Usually, the value is "\r\n".
Example:
com.init(1, 230400, "NONE", 1, "RS485"); com.write(1, "Enter any number: "); s=com.read(1, 3000, "\r\n"); s=s+1; s="\r\nYour number + 1 = "..s.."\r\n"; com.write(1, s);