serOpen (Function) |
Top Previous Next |
serOpen will open the serial port for direct access in either RS232 or RS485 mode depending on the capabilities of the port. Please note that a special cable may be required (see ser: Serial port).
Input: port : SINT (0..127) (default 0) Selects which serial port to use. 0 is the programming port on non-USB devices, 1 is serial port 2, 2 is serial port 3, 3 is serial port 4. Not all serial ports are available on all devices. Please consult the technical manual of the specific device for more information. On the NX32L, the port numbers from usbHostGetSerialPort, btSerialPortProfileConnect and btHandleSerialPortIncomingConnection can also be used.
baud : DINT (1200,2400,4800,9600,19200,38400,57600,115200) (default 9600) The desired baud rate.
bit : SINT (7/8) (default 8) Selects the number of bits/character 7 bit without parity bit only works on LX devices.
parity : SINT (0,1,2) (default 0) Selects the desired parity. 0 is none, 1 is even, and 2 is odd.
stopbit : SINT (1,2) (default 1) Selects the number of stop bits.
Note: Only 1 stop bit is supported on the RS485 ports on NX devices.
rs485 : BOOL (default false) This sets to true if communication is through the RS485 port, and false if the RS232 port is used.
Returns: INT
Declaration: FUNCTION serOpen : INT;
Example: INCLUDE rtcu.inc |