EasyManua.ls Logo

Keysight Technologies M8000 Series

Keysight Technologies M8000 Series
668 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
576 Keysight M8000 Series of BER Test Solutions User Guide
9 Utilities
# additional reference assembly mscorlib to have all data
types
# available that are used by SerialPort
clr.AddReference("mscorlib")
Open the COM Port
# create an instance of SerialPort for COM4
serialPort = System.IO.Ports.SerialPort("COM4")
# configure COM4 to 9600 bit/s 8N1
serialPort.BaudRate = int (9600)
serialPort.DataBits = int(8)
# available choices for Parity are
# None: System.IO.Ports.Parity.None
# Odd : System.IO.Ports.Parity.Odd
# Even : System.IO.Ports.Parity.Even
# Mark : System.IO.Ports.Parity.Mark
# Space : System.IO.Ports.Parity.Space
serialPort.Parity = System.IO.Ports.Parity.None
# available choices for StopBits are
# None : System.IO.Ports.StopBits.None
# One : System.IO.Ports.StopBits.One
# Two : System.IO.Ports.StopBits.Two
# OnePointFive : System.IO.Ports.StopBits.OnePointFive
serialPort.StopBits = System.IO.Ports.StopBits.One
# set read and write timeouts to 500ms
serialPort.ReadTimeout = int(500)
serialPort.WriteTimeout = int(500)
# finally open the COM port
serialPort.Open()
Reading and Writing Data
# write a string
serialPort.Write("Sending string data")
# sending binary data
# prepare the data to be sent. SerialPort expects an Array
of Byte. This requires importing mscorlib!

Table of Contents

Other manuals for Keysight Technologies M8000 Series

Related product manuals