# set-baud command

The set-baud BASIC program sets the
baud rate for the current port or for another port.

## Syntax (all platforms)

```
set-baud port.number{,rate,parity,stop.bits,word.len}}
```

## Syntax (For Windows- Not Supported)

```
set-baud {tty{,rate,{parity,stop.bits,word.len}}}
```

## Parameter(s)

| port.number | Serial port to change. If the port number is not specified, the baud rate is set on the current port. A -1 can also be specified to indicate the current port. The baud rate can be one of these supported baud rates: 110, 150, 300, 600, 1200, 2400, 4800, 9600, 19200. The default baud rate for each port is 9600. For UNIX: The port number can be specified either by a number or by a device name, such as /dev/tty3, in which case the port does not have to be connected to the D3 virtual machine. /dev/ can be omitted. This command is provided for compatibility with non-UNIX implementations. For Windows: Supports the serial port number specified. |
| --- | --- |
| word.len | Data length, which can be any number between 5 and 8, inclusive. For UNIX: If no UNIX process is connected to the device, set-baud displays: ```
Process not connected.
``` In this case, the device is probably not initialized properly or not connected to a physical terminal. The form with a tty name, instead of a port number, should then be used. For Windows: Supports the specified port number and data length. |
| parity | Data parity. Note that there is no mark or space parity supported. These values are permitted: |
| 0 or n | Indicates no parity. |
| 1 or o | Indicates odd parity. |
| 2 or e | Indicates even parity. |
| stop.bits | Number of data stop bits, which can be 0, 1, or 2. |
Warning: **For UNIX:** The UNIX stty command can be used to change the port setting, except for the current
port. **For Windows:** The stty command is not
supported.

## Example(s)

```
set-baud
Line number: 4 (/dev/tty4)
Baud rate : 9600
Parity : none
Stop bits : 1
Word length : 8
```

## See also

- [attr.code](https://d3codex.com/attributedefiningitem/attr-code/)
- [Attribute](https://d3codex.com/definitions/attribute/)
- [attribute-count](https://d3codex.com/attributedefiningitem/attribute-count/)
- [attribute-name](https://d3codex.com/attributedefiningitem/attribute-name/)
- [Hot key commands](https://d3codex.com/updateprocessor/hot-key-commands/)
- [i (local index) processing code](https://d3codex.com/processingcodes/i-local-index-processing-code/)
- [Port number](https://d3codex.com/definitions/port-number/)
- [reset-port command](https://d3codex.com/tcl/reset-port-command/)
- [set-port command](https://d3codex.com/tcl/set-port-command/)
- [setport command](https://d3codex.com/tcl/setport-command/)
- [System privileges](https://d3codex.com/definitions/system-privileges/)
- [user-coldstart macro](https://d3codex.com/tcl/user-coldstart-macro/)

---
Source: https://d3codex.com/tcl/set-baud-command/ - part of the D3Codex reference.
