Serial Port Complete - Latest Microcontroller projects

(lily) #1

Chapter 12


 myComPort.DataBits = 8;
myComPort.ParityReplace = 0;
myComPort.Open();
To write to a node, select Mark parity, write the node’s address, and then select
Space parity and write the data intended for that node.


 ' Write a node's address.


myComPort.Parity = Parity.Mark
myComPort.Write("h")

' Delay as needed to ensure that the address has transmitted.
' Write data to the node.

myComPort.Parity = Parity.Space
myComPort.WriteLine("Test data for node h.")

' Delay as needed to ensure that the data has transmitted.
' Write a node's address.

myComPort.Parity = Parity.Mark
myComPort.Write("m")

' Delay as needed to ensure that the address has transmitted.
' Write data to the node.

myComPort.Parity = Parity.Space
myComPort.WriteLine("Test data for node m.")
Free download pdf