Set port parameters

Command group Flag affected Reversible Execute on client Platform(s)
Report destinations YES NO NO All

Syntax

Set port parameters {profile-spec (<profile>,<cpi>,<lpi>) or parameters (e.g. 9600,n,8,1,x,10,6)}

Description

This command sets the port parameters. When you use Select port in a method, the baud rate and other parameters are set to the values configured for the system, or the values set by the last application to use the port. If you need to change the settings you can do so with this command, which should follow a Send to port. The flag is set if the command is successful.

The first five parameters only apply to serial ports. The last three (CPI, LPI, timeout) apply to both serial and parallel ports.

You specify the flow control parameter as either X, H or R (in upper or lower case).

The maximum value for the transmit XON threshold and transmit XOFF threshold, in the flow control settings, is too large for Windows. 4096 works but in practice the value required will depend on what device is connected to the port.

The CPI and LPI parameters are numbers that specify characters and lines per inch. These are used by Omnis to justify fields in the report, and are not sent as control characters to the printer.

The timeout specifies the time in seconds that Omnis will wait for data transfer activity on the port, before aborting the transfer; each time there is new data transfer activity, Omnis restarts the timeout timer. If omitted, it defaults to the value stored in the report destination parameters for the port destination. A value of zero means that operations will not time out.

You can use a port profile name instead of the port parameters as described above.

Example

# example 1
# set a baud rate of 9600, no parity, eight data bits and 1 stop bit
Set port parameters {9600,n,8,1}

# example 2
# The extra comma indicates no change to the handshake parameter (X/H/R)
Set port parameters {9600,n,8,1,,10,6}
# set up the XON/XOFF handshale protocol
Set port parameters {9600,n,7,1,X}

# example 3
Set report name rMyReport
Send to port
If platform()='X'
  Set port name {1 (Modem port)} ## macOS
Else
  Set port name {COM1:} ## Windows & Linux
End If
Set port parameters {1200,n,7,2}
Print report