Specify bit transmit rate
You configure BaudRate
as bits per second.
The transferred bits include the start bit, the data bits, the parity
bit (if used), and the stop bits. However, only the data bits are
stored.
The baud rate is the rate at which information is transferred
in a communication channel. In the serial port context, "9600 baud"
means that the serial port is capable of transferring a maximum of
9600 bits per second. If the information unit is one baud (one bit),
then the bit rate and the baud rate are identical. If one baud is
given as 10 bits, (for example, eight data bits plus two framing bits),
the bit rate is still 9600 but the baud rate is 9600/10, or 960. You
always configure BaudRate
as bits per second.
Therefore, in the above example, set BaudRate
to
9600.
Note
Both the computer and the instrument must be configured to the same baud rate before you can successfully read or write data.
Your system computes the acceptable rates by taking the baud base, which is determined by your serial port, and dividing it by a positive whole number divisor . The system will try to find the best match by modifying the divisor. For example, if:
baud base = 115200 bits per second divisors = 1,2,3,4,5…. Possible BaudRates = 115200, 57600, 38400, 28800, 23040….
Your system may further limit the available baud rates to conform to specific conventions or standards. In the above example, for instance, 23040 bits/sec may not be available on all systems.
Usage | Serial port, VISA-serial |
Read only | Never |
Data type | Double |
The default value is 9600
bits per second.
This example shows how to set the baud rate for a serial port object.
Create a serial port object associated with the COM1 port. The oscilloscope you are connecting to over the serial port is configured to a baud rate of 115200 and a carriage return terminator, so set the serial port object to those values.
s = serial('COM1'); s.Baudrate = 115200; s.Terminator = 'CR';