|
PortController.NET
StopBits Property
Sets and returns the stop bits communications parameter.
Syntax
[Visual Basic]
object.StopBits [ = value ]
[C#]
object.StopBits [ = value ]
[C++]
object->StopBits [ = value ]
Parameters
object
An object expression that evaluates to a PortController object.
value
A value of type StopBitsValue indicating the stop bits setting.
Return Value
A value of type StopBitsValue representing the stop bits setting.
Remarks
- StopBits values are contained in the SciCom.PortController.StopBitsValue namespace
- Valid StopBits values are as follows:
- StopBits_1 (Default)
- StopBits_1_5 (1.5 stop bits)
- StopBits_2
Default
StopBits_1
Errors
- Attempting to set StopBits to an invalid value
will cause the PortController to throw an "Invalid argument" exception.
- Attempting to set StopBits to 1.5 when
DataBits is 6, 7, or 8 is illegal and will cause PortController to throw
a "Invalid stop bits / data bits combination" exception if the port is open. If the port is closed, no
exception will be thrown.
- Attempting to set StopBits to 2 when
DataBits is 5 is illegal and will cause PortController to throw
a "Invalid stop bits / data bits combination" exception.
Example
[Visual Basic]
'Set stop bits
myPortController.StopBits = SciCom.PortController.StopBitsValue.StopBits_1
'Get stop bits
Dim stopBits as SciCom.PortController.StopBitsValue
stopBits = myPortController.StopBits
[C#]
// Set stop bits
myPortController.StopBits = SciCom.PortController.StopBitsValue.StopBits_1;
// Get stop bits
SciCom.PortController.StopBitsValue stopBits = myPortController.StopBits;
[C++]
// Set stop bits
myPortController->StopBits = SciCom::PortController::StopBitsValue::StopBits_1;
// Get stop bits
SciCom::PortController::StopBitsValue stopBits = myPortController->StopBits;
See Also
DataBits property | BaudRate property | Parity property | Open method
|