You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13-9Lines changed: 13 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,32 +26,32 @@ var port = new SerialPort("COM2");
26
26
27
27
Note that the port name **must** be `COMx` where x is a number.
28
28
29
-
The GetPortNames method will gi you a list of available ports:
29
+
The `GetPortNames` method will give you a list of available ports:
30
30
31
31
```csharp
32
32
varports=SerialPort.GetPortNames();
33
33
```
34
34
35
-
You can as well directly specify the baud rate and other elements in the constructor:
35
+
You can also directly specify the baud rate and other elements in the constructor:
36
36
37
37
```csharp
38
38
varport=newSerialPort("COM2", 115200);
39
39
```
40
40
41
-
Each property can be adjusted, including while the port is open. Be aware that this can generate hazardous behaviors. It is always recommended to change the properties once the port is closed.
41
+
Each property can be adjusted, including when the port is open. Be aware that this can generate hazardous behaviors. It is always recommended to change the properties while the port is closed.
42
42
43
-
**Important**: you should setup a timeout for the read and write operations. If you have none, while operating a read or a write, you will wait indefinitely to read or write that everything is received or sent.
43
+
**Important**: You should setup a timeout for the read and write operations. If you have none, read or a write periods may cause theads to be locked for indefinite periods.
44
44
45
45
```csharp
46
46
port.WriteTimeout=1000;
47
47
port.ReadTimeout=1000;
48
48
```
49
49
50
-
Note: some MCU do not support Hankshake or specific bit parity even if you can set them up in the constructor.
50
+
Note: some MCU do not support Handshake or specific bit parity even if you can set them up in the constructor.
51
51
52
52
### Opening and Closing the port
53
53
54
-
The port can only be in operation once open and will finish his operations when closed. If you dispose the SerialPort, it will close it before.
54
+
The `SerialPort` can only operate once open and will finish the operations when closed. When disposed, the `SerialPort`will perform the close operation regardless of any ongoing receive or transmit operations.
55
55
56
56
```csharp
57
57
varport=newSerialPort("COM2");
@@ -62,7 +62,8 @@ port.Close();
62
62
63
63
### Read and Write
64
64
65
-
You have multiple functions to read and write, some are byte related, others string related. Note that the string one will use the `Enconding` charset that you will define. By default, this is UTF8.
65
+
You have multiple functions to read and write, some are byte related, others string related.
66
+
Note that string functions will use UTF8 `Encoding` charset.
0 commit comments